text: CREATE SCHEMA "public";
  
  CREATE SCHEMA test_schema;
  
  CREATE TABLE "public".example_a ( 
  	column_a             varchar  NOT NULL ,
  	column_b             varchar  NOT NULL ,
  	column_c             integer   ,
  	column_d             integer[]   ,
  	column_e             varchar []   ,
  	column_f             text[]   ,
  	column_g             bool[]   ,
  	column_h             json[]   ,
  	column_i             varchar  NOT NULL ,
  	CONSTRAINT pk_example_a PRIMARY KEY ( column_a, column_b ),
  	CONSTRAINT unq_example_a UNIQUE ( column_i ) 
   );
  
  CREATE INDEX idx_example_a ON "public".example_a ( column_c );
  
  COMMENT ON TABLE "public".example_a IS 'If generated by DBSchema, then SQL file needs to be fixed up. The ''[]'' needs to be part of the datatype (no spaces)';
  
  CREATE TABLE "public".excluded ( 
  	column1              integer  NOT NULL ,
  	column2              integer  NOT NULL ,
  	column3              varchar   ,
  	CONSTRAINT pk_public_excluded PRIMARY KEY ( column1, column2 )
   );
  
  CREATE TABLE "public".foo ( 
  	bar                  varchar  NOT NULL ,
  	baz                  varchar   ,
  	CONSTRAINT pk_test_schema_foo_bar PRIMARY KEY ( bar )
   );
  
  CREATE TABLE "public".part ( 
  	part_id              serial  NOT NULL ,
  	part_name            varchar(100)   ,
  	CONSTRAINT pk_public_parts_part_id PRIMARY KEY ( part_id )
   );
  
  CREATE TABLE "public".part_part ( 
  	part_id              int  NOT NULL ,
  	child_part_id        int  NOT NULL ,
  	CONSTRAINT pk_public_part_part PRIMARY KEY ( part_id, child_part_id )
   );
  
  COMMENT ON TABLE "public".part_part IS 'This table represents a many to many nested / recursive relationship. This should result in a repeated message.';
  
  CREATE TABLE "public".product ( 
  	product_id           serial  NOT NULL ,
  	product_name         varchar(100)   ,
  	sku                  varchar(100)   ,
  	produced             timestamptz DEFAULT current_timestamp  ,
  	id                   int   ,
  	CONSTRAINT pk_public_table_id PRIMARY KEY ( product_id )
   );
  
  CREATE INDEX idx_product ON "public".product ( id );
  
  COMMENT ON INDEX idx_product IS 'This index will not generate an accessor method.';
  
  CREATE INDEX lookup_sku ON "public".product ( sku );
  
  COMMENT ON INDEX lookup_sku IS 'Any index that is prefixed with ''lookup_'' will become an accessor methodin the code generated by go_dbmap.';
  
  COMMENT ON TABLE "public".product IS 'This table represents a top level entity with an identifying primary key.\n\n#service:product';
  
  CREATE TABLE "public".product_parts ( 
  	product_id           int  NOT NULL ,
  	part_id              int  NOT NULL ,
  	CONSTRAINT pk_public_product_parts PRIMARY KEY ( product_id, part_id )
   );
  
  COMMENT ON TABLE "public".product_parts IS 'This table represents a many to many relationship between two different entities.\n\n#service: product';
  
  CREATE TABLE "public".example_b ( 
  	column_a             varchar  NOT NULL ,
  	column_b1            varchar  NOT NULL ,
  	column_1             integer  NOT NULL ,
  	test_id              integer   ,
  	p_bar                varchar   ,
  	t_bar                varchar   ,
  	CONSTRAINT pk_example_b_column_1 PRIMARY KEY ( column_1 ),
  	CONSTRAINT idx_example_b_column_a UNIQUE ( column_a ) 
   );
  
  CREATE TABLE "public".example_c ( 
  	column_aa            integer  NOT NULL ,
  	column_a             varchar  NOT NULL ,
  	CONSTRAINT pk_example_c_column_aa PRIMARY KEY ( column_aa )
   );
  
  COMMENT ON COLUMN "public".example_c.column_a IS 'This shows a weird corner case where a column that is part of a composite foreign key is referencing another table as a single column';
  
  CREATE TABLE test_schema.address ( 
  	address_id           serial  NOT NULL ,
  	address1             varchar(100)   ,
  	address2             varchar(100)   ,
  	city                 varchar   ,
  	"state"              varchar   ,
  	country              char(2)   ,
  	postcode             varchar   ,
  	CONSTRAINT pk_address_address_d PRIMARY KEY ( address_id )
   );
  
  CREATE TABLE test_schema.foo ( 
  	bar                  varchar  NOT NULL ,
  	baz                  varchar   ,
  	CONSTRAINT pk_test_schema_foo_bar PRIMARY KEY ( bar )
   );
  
  CREATE TABLE test_schema.test_table_no_pkey ( 
  	bigint_col           bigint   ,
  	bigint_array_col     bigint[]   ,
  	big_serial_col       bigserial   ,
  	bool_col             bool   ,
  	bytea_col            bytea   ,
  	char_col             char(100)   ,
  	cidr_col             cidr   ,
  	date_col             date DEFAULT current_date  ,
  	float8_col           float8   ,
  	inet_col             inet   ,
  	integer_col          integer   ,
  	integer_array_col    integer[]   ,
  	json_col             json   ,
  	numeric_precision_col numeric(9,4)   ,
  	numeric_col          numeric   ,
  	real_col             real   ,
  	serial_col           serial   ,
  	smallint_col         smallint   ,
  	smallint_array_col   smallint[]   ,
  	smallserial_col      smallserial   ,
  	text_col             text   ,
  	time_col             time DEFAULT current_time  ,
  	timestamp_col        timestamp DEFAULT current_timestamp  ,
  	timestampz_col       timestamptz DEFAULT current_timestamp  ,
  	uuid_col             uuid   ,
  	varchar_col          varchar   ,
  	varchar_length_col   varchar(256)   ,
  	xml_col              xml   ,
  	int_col              int   ,
  	decimal_col          decimal   
   );
  
  COMMENT ON TABLE test_schema.test_table_no_pkey IS 'This table will enumerate every postgres data type as of 9.5';
  
  CREATE TABLE test_schema.test_table_pkey ( 
  	bigint_col           bigint   ,
  	bigint_array_col     bigint[]   ,
  	big_serial_col       bigserial   ,
  	bool_col             bool   ,
  	bytea_col            bytea   ,
  	char_col             char(100)   ,
  	cidr_col             cidr   ,
  	date_col             date DEFAULT current_date  ,
  	float8_col           float8   ,
  	inet_col             inet   ,
  	integer_col          integer   ,
  	integer_array_col    integer[]   ,
  	json_col             json   ,
  	numeric_precision_col numeric(9,4)   ,
  	numeric_col          numeric   ,
  	real_col             real   ,
  	serial_col           serial   ,
  	smallint_col         smallint   ,
  	smallint_array_col   smallint[]   ,
  	smallserial_col      smallserial   ,
  	text_col             text   ,
  	time_col             time DEFAULT current_time  ,
  	timestamp_col        timestamp DEFAULT current_timestamp  ,
  	timestampz_col       timestamptz DEFAULT current_timestamp  ,
  	uuid_col             uuid   ,
  	varchar_col          varchar   ,
  	varchar_length_col   varchar(256)   ,
  	xml_col              xml   ,
  	int_col              int   ,
  	decimal_col          decimal   ,
  	id                   serial  NOT NULL ,
  	CONSTRAINT pk_test_table_no_pkey_0_id PRIMARY KEY ( id )
   );
  
  COMMENT ON TABLE test_schema.test_table_pkey IS 'This table will enumerate every postgres data type as of 9.5 with a primary key';
  
  CREATE TABLE test_schema."user" ( 
  	user_id              serial  NOT NULL ,
  	first_name           varchar(100)   ,
  	last_name            varchar(100)   ,
  	email                varchar  NOT NULL ,
  	geog                 geography(point)   ,
  	pword_hash           bytea   ,
  	user_token           uuid DEFAULT uuid_generate_v1mc() NOT NULL ,
  	enabled              bool DEFAULT true NOT NULL ,
  	aka_id               int   ,
  	CONSTRAINT lookup_email UNIQUE ( email ) ,
  	CONSTRAINT pk_user PRIMARY KEY ( user_id )
   );
  
  COMMENT ON CONSTRAINT lookup_email ON test_schema."user" IS 'Any index that is prefixed with ''lookup_'' will become an accessor methodin the code generated by go_dbmap.';
  
  CREATE INDEX lookup_name ON test_schema."user" ( first_name, last_name );
  
  COMMENT ON TABLE test_schema."user" IS 'This table will help test secondary lookup via email.\n\n#service: user';
  
  CREATE TABLE test_schema.user_product_part ( 
  	user_id              integer  NOT NULL ,
  	product_id           integer  NOT NULL ,
  	part_id              integer  NOT NULL ,
  	inserted_on          bigint  NOT NULL ,
  	CONSTRAINT pk_user_product_part PRIMARY KEY ( user_id, product_id, part_id ),
  	CONSTRAINT unq_user_product_part_product_id UNIQUE ( product_id ) ,
  	CONSTRAINT unq_user_product_part_user_id UNIQUE ( user_id ) 
   );
  
  COMMENT ON TABLE test_schema.user_product_part IS '#service: user';
  
  COMMENT ON COLUMN test_schema.user_product_part.inserted_on IS 'The UNIX epoch';
  
  ALTER TABLE "public".example_b ADD CONSTRAINT fk_example_b_example_a FOREIGN KEY ( column_a, column_b1 ) REFERENCES "public".example_a( column_a, column_b );
  
  ALTER TABLE "public".example_b ADD CONSTRAINT fk_example_b_test_table_pkey FOREIGN KEY ( test_id ) REFERENCES test_schema.test_table_pkey( id );
  
  ALTER TABLE "public".example_b ADD CONSTRAINT fk_example_b_pfoo FOREIGN KEY ( p_bar ) REFERENCES "public".foo( bar );
  
  ALTER TABLE "public".example_b ADD CONSTRAINT fk_example_b_tfoo FOREIGN KEY ( t_bar ) REFERENCES test_schema.foo( bar );
  
  ALTER TABLE "public".example_c ADD CONSTRAINT fk_example_b_example_c FOREIGN KEY ( column_a ) REFERENCES "public".example_b( column_a );
  
  COMMENT ON CONSTRAINT fk_example_b_example_c ON "public".example_c IS 'This is an example of a foreign relationship that is defined on a column that is not identified by a key. While you can put a unique constraint on the referenced column, this will never formalize in a constraint where you know the referenced table in postgres.';
  
  ALTER TABLE "public".part_part ADD CONSTRAINT fk_public_part_part_public_part FOREIGN KEY ( part_id ) REFERENCES "public".part( part_id );
  
  ALTER TABLE "public".part_part ADD CONSTRAINT fk_public_part_part_public_part_0 FOREIGN KEY ( child_part_id ) REFERENCES "public".part( part_id );
  
  ALTER TABLE "public".product ADD CONSTRAINT fk_public_product_test_table_pkey FOREIGN KEY ( id ) REFERENCES test_schema.test_table_pkey( id );
  
  ALTER TABLE "public".product_parts ADD CONSTRAINT fk_parts_product FOREIGN KEY ( product_id ) REFERENCES "public".product( product_id );
  
  ALTER TABLE "public".product_parts ADD CONSTRAINT fk_product_parts_part FOREIGN KEY ( part_id ) REFERENCES "public".part( part_id );
  
  ALTER TABLE test_schema."user" ADD CONSTRAINT fk_user_user FOREIGN KEY ( aka_id ) REFERENCES test_schema."user"( user_id );
  
  ALTER TABLE test_schema.user_product_part ADD CONSTRAINT fk_user_product_part_product FOREIGN KEY ( product_id ) REFERENCES "public".product( product_id );
  
  ALTER TABLE test_schema.user_product_part ADD CONSTRAINT fk_user_product_part_user FOREIGN KEY ( user_id ) REFERENCES test_schema."user"( user_id );
  
  ALTER TABLE test_schema.user_product_part ADD CONSTRAINT fk_user_product_part_part FOREIGN KEY ( part_id ) REFERENCES "public".part( part_id );
  
  