From d625119bd39182bda623b1d47d06df026a44df42 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Fri, 1 Sep 2023 12:46:12 -0700 Subject: [PATCH] test(endtoend): Fix issues with PostgreSQL tests --- .../endtoend/testdata/citext/pgx/query.sql | 3 ++- .../endtoend/testdata/citext/stdlib/query.sql | 2 ++ .../postgresql/pgx/v4/schema.sql | 2 +- .../postgresql/pgx/v5/schema.sql | 2 +- .../postgresql/stdlib/schema.sql | 2 +- .../postgresql/pgx/v4/schema.sql | 2 +- .../postgresql/pgx/v5/schema.sql | 2 +- .../postgresql/stdlib/schema.sql | 2 +- .../postgresql/pgx/v4/go/models.go | 15 +++++++++++++-- .../postgresql/pgx/v4/schema.sql | 19 ++++++++++++++++--- .../postgresql/pgx/v5/go/models.go | 14 ++++++++++++-- .../postgresql/pgx/v5/schema.sql | 19 ++++++++++++++++--- .../postgresql/stdlib/go/models.go | 15 +++++++++++++-- .../postgresql/stdlib/schema.sql | 18 +++++++++++++++--- .../postgresql/pgx/v4/schema.sql | 2 +- .../postgresql/pgx/v5/schema.sql | 2 +- .../postgresql/stdlib/schema.sql | 2 +- .../postgresql/pgx/v4/schema.sql | 2 +- .../postgresql/pgx/v5/schema.sql | 2 +- .../postgresql/stdlib/schema.sql | 2 +- .../postgresql/pgx/v4/schema.sql | 2 +- .../postgresql/pgx/v5/schema.sql | 2 +- .../postgresql/stdlib/schema.sql | 2 +- .../postgresql/pgx/v4/schema.sql | 2 +- .../postgresql/pgx/v5/schema.sql | 2 +- .../postgresql/stdlib/schema.sql | 2 +- .../postgresql/pgx/v4/schema.sql | 2 +- .../postgresql/pgx/v5/schema.sql | 2 +- .../postgresql/stdlib/schema.sql | 2 +- .../postgresql/pgx/v4/go/models.go | 8 ++++++++ .../ddl_pg_temp/postgresql/pgx/v4/schema.sql | 4 +++- .../postgresql/pgx/v5/go/models.go | 8 ++++++++ .../ddl_pg_temp/postgresql/pgx/v5/schema.sql | 4 +++- .../postgresql/stdlib/go/models.go | 8 ++++++++ .../ddl_pg_temp/postgresql/stdlib/schema.sql | 4 +++- .../func_return/postgresql/pgx/v4/schema.sql | 14 ++++++++------ .../func_return/postgresql/pgx/v5/schema.sql | 14 ++++++++------ .../func_return/postgresql/stdlib/schema.sql | 10 ++++++---- .../testdata/hstore/pgx/v4/hstore.sql | 2 ++ .../testdata/hstore/pgx/v5/hstore.sql | 2 ++ .../testdata/hstore/stdlib/hstore.sql | 2 ++ .../testdata/identifier_dollar_sign/query.sql | 3 ++- .../join_alias/postgresql/pgx/v4/query.sql | 2 +- .../join_alias/postgresql/pgx/v5/query.sql | 2 +- .../join_alias/postgresql/stdlib/query.sql | 2 +- .../testdata/join_full/postgresql/query.sql | 4 ++-- .../testdata/join_right/postgresql/query.sql | 4 ++-- .../postgresql/pgx/v4/query.sql | 2 +- .../postgresql/pgx/v5/query.sql | 2 +- .../postgresql/stdlib/query.sql | 2 +- .../testdata/multischema/pgx/v4/query.sql | 2 +- .../testdata/multischema/pgx/v5/query.sql | 2 +- .../testdata/multischema/stdlib/query.sql | 2 +- .../postgresql/pgx/v4/query.sql | 4 ++-- .../postgresql/pgx/v5/query.sql | 4 ++-- .../postgresql/stdlib/query.sql | 4 ++-- .../postgresql/pgx/v4/schema.sql | 4 ++-- .../postgresql/pgx/v5/schema.sql | 4 ++-- .../postgresql/stdlib/schema.sql | 2 +- .../overrides_result_tag/stdlib/query.sql | 4 +++- .../unnest/postgresql/pgx/v4/schema.sql | 5 ++++- .../unnest/postgresql/pgx/v5/schema.sql | 5 ++++- .../unnest/postgresql/stdlib/schema.sql | 4 ++++ 63 files changed, 212 insertions(+), 84 deletions(-) diff --git a/internal/endtoend/testdata/citext/pgx/query.sql b/internal/endtoend/testdata/citext/pgx/query.sql index 2e358ab8d0..b686dec569 100644 --- a/internal/endtoend/testdata/citext/pgx/query.sql +++ b/internal/endtoend/testdata/citext/pgx/query.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS citext; + CREATE TABLE foo ( bar citext, bat citext not null @@ -6,4 +8,3 @@ CREATE TABLE foo ( -- name: GetCitexts :many SELECT bar, bat FROM foo; - diff --git a/internal/endtoend/testdata/citext/stdlib/query.sql b/internal/endtoend/testdata/citext/stdlib/query.sql index 14543023c7..d569fc9a73 100644 --- a/internal/endtoend/testdata/citext/stdlib/query.sql +++ b/internal/endtoend/testdata/citext/stdlib/query.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS citext; + CREATE TABLE foo ( bar citext, bat citext not null diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/schema.sql index 75a7a7bfbc..26fa6c7c9c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE foo (bar TEXT); -ALTER TABLE foo ALTER bar TYPE TEXT ARRAY; +ALTER TABLE foo ALTER bar TYPE TEXT ARRAY USING bar::text[]; diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/schema.sql index 75a7a7bfbc..26fa6c7c9c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE foo (bar TEXT); -ALTER TABLE foo ALTER bar TYPE TEXT ARRAY; +ALTER TABLE foo ALTER bar TYPE TEXT ARRAY USING bar::text[]; diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/schema.sql index 75a7a7bfbc..26fa6c7c9c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE foo (bar TEXT); -ALTER TABLE foo ALTER bar TYPE TEXT ARRAY; +ALTER TABLE foo ALTER bar TYPE TEXT ARRAY USING bar::text[]; diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/schema.sql index 9477f00e68..1dbb844fa5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE venues (id SERIAL PRIMARY KEY); -ALTER TABLE venues DROP CONSTRAINT venues_id_pkey; \ No newline at end of file +ALTER TABLE venues DROP CONSTRAINT venues_pkey; diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/schema.sql index 9477f00e68..1dbb844fa5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE venues (id SERIAL PRIMARY KEY); -ALTER TABLE venues DROP CONSTRAINT venues_id_pkey; \ No newline at end of file +ALTER TABLE venues DROP CONSTRAINT venues_pkey; diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/schema.sql index 9477f00e68..1dbb844fa5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE venues (id SERIAL PRIMARY KEY); -ALTER TABLE venues DROP CONSTRAINT venues_id_pkey; \ No newline at end of file +ALTER TABLE venues DROP CONSTRAINT venues_pkey; diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go index 217da30204..d8a9aecdf8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go @@ -6,8 +6,19 @@ package querytest import ( "database/sql" + "time" ) -type Temp struct { - A sql.NullString +type Measurement struct { + CityID int32 + Logdate time.Time + Peaktemp sql.NullInt32 + Unitsales sql.NullInt32 +} + +type MeasurementY2006m02 struct { + CityID int32 + Logdate time.Time + Peaktemp sql.NullInt32 + Unitsales sql.NullInt32 } diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/schema.sql index ead14d04ee..0fb8fb143e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/schema.sql @@ -1,4 +1,17 @@ -CREATE TABLE temp(a TEXT); +CREATE TABLE measurement ( + city_id int not null, + logdate date not null, + peaktemp int, + unitsales int +) PARTITION BY RANGE (logdate); -CREATE INDEX temp_idx ON temp(a); -ALTER INDEX temp_idx ATTACH PARTITION temp_partition_idx; +CREATE TABLE measurement_y2006m02 PARTITION OF measurement + FOR VALUES FROM ('2006-02-01') TO ('2006-03-01'); + +CREATE INDEX measurement_usls_idx ON ONLY measurement (unitsales); + +CREATE INDEX measurement_usls_200602_idx + ON measurement_y2006m02 (unitsales); + +ALTER INDEX measurement_usls_idx + ATTACH PARTITION measurement_usls_200602_idx; diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go index dc62a3f7f4..6ded4e5e98 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go @@ -8,6 +8,16 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -type Temp struct { - A pgtype.Text +type Measurement struct { + CityID int32 + Logdate pgtype.Date + Peaktemp pgtype.Int4 + Unitsales pgtype.Int4 +} + +type MeasurementY2006m02 struct { + CityID int32 + Logdate pgtype.Date + Peaktemp pgtype.Int4 + Unitsales pgtype.Int4 } diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/schema.sql index ead14d04ee..0fb8fb143e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/schema.sql @@ -1,4 +1,17 @@ -CREATE TABLE temp(a TEXT); +CREATE TABLE measurement ( + city_id int not null, + logdate date not null, + peaktemp int, + unitsales int +) PARTITION BY RANGE (logdate); -CREATE INDEX temp_idx ON temp(a); -ALTER INDEX temp_idx ATTACH PARTITION temp_partition_idx; +CREATE TABLE measurement_y2006m02 PARTITION OF measurement + FOR VALUES FROM ('2006-02-01') TO ('2006-03-01'); + +CREATE INDEX measurement_usls_idx ON ONLY measurement (unitsales); + +CREATE INDEX measurement_usls_200602_idx + ON measurement_y2006m02 (unitsales); + +ALTER INDEX measurement_usls_idx + ATTACH PARTITION measurement_usls_200602_idx; diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go index 217da30204..d8a9aecdf8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go @@ -6,8 +6,19 @@ package querytest import ( "database/sql" + "time" ) -type Temp struct { - A sql.NullString +type Measurement struct { + CityID int32 + Logdate time.Time + Peaktemp sql.NullInt32 + Unitsales sql.NullInt32 +} + +type MeasurementY2006m02 struct { + CityID int32 + Logdate time.Time + Peaktemp sql.NullInt32 + Unitsales sql.NullInt32 } diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/schema.sql index b74a806845..0fb8fb143e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/schema.sql @@ -1,5 +1,17 @@ -CREATE TABLE temp(a TEXT); +CREATE TABLE measurement ( + city_id int not null, + logdate date not null, + peaktemp int, + unitsales int +) PARTITION BY RANGE (logdate); -CREATE INDEX temp_idx ON temp(a); -ALTER INDEX temp_idx ATTACH PARTITION temp_partition_idx; +CREATE TABLE measurement_y2006m02 PARTITION OF measurement + FOR VALUES FROM ('2006-02-01') TO ('2006-03-01'); +CREATE INDEX measurement_usls_idx ON ONLY measurement (unitsales); + +CREATE INDEX measurement_usls_200602_idx + ON measurement_y2006m02 (unitsales); + +ALTER INDEX measurement_usls_idx + ATTACH PARTITION measurement_usls_200602_idx; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/schema.sql index 1ae8a69bf6..5ef5dc5489 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE foo (bar text); -ALTER TABLE foo ALTER bar SET DATA TYPE bool; \ No newline at end of file +ALTER TABLE foo ALTER bar SET DATA TYPE bool USING bar::boolean; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/schema.sql index 1ae8a69bf6..5ef5dc5489 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE foo (bar text); -ALTER TABLE foo ALTER bar SET DATA TYPE bool; \ No newline at end of file +ALTER TABLE foo ALTER bar SET DATA TYPE bool USING bar::boolean; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/schema.sql index 1ae8a69bf6..5ef5dc5489 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE foo (bar text); -ALTER TABLE foo ALTER bar SET DATA TYPE bool; \ No newline at end of file +ALTER TABLE foo ALTER bar SET DATA TYPE bool USING bar::boolean; diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/schema.sql index a318fb91f2..4b98ce9597 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/schema.sql @@ -1 +1 @@ -CREATE FUNCTION foo(bar TEXT, baz TEXT="baz") RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; \ No newline at end of file +CREATE FUNCTION foo(bar TEXT, baz TEXT='baz') RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/schema.sql index a318fb91f2..4b98ce9597 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/schema.sql @@ -1 +1 @@ -CREATE FUNCTION foo(bar TEXT, baz TEXT="baz") RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; \ No newline at end of file +CREATE FUNCTION foo(bar TEXT, baz TEXT='baz') RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/schema.sql index a318fb91f2..4b98ce9597 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/schema.sql @@ -1 +1 @@ -CREATE FUNCTION foo(bar TEXT, baz TEXT="baz") RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; \ No newline at end of file +CREATE FUNCTION foo(bar TEXT, baz TEXT='baz') RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/schema.sql index b3a3f3b158..876d0f8e80 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/schema.sql @@ -1,2 +1,2 @@ CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; -CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT "baz" $$ LANGUAGE sql; \ No newline at end of file +CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT 'baz' $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/schema.sql index b3a3f3b158..876d0f8e80 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/schema.sql @@ -1,2 +1,2 @@ CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; -CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT "baz" $$ LANGUAGE sql; \ No newline at end of file +CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT 'baz' $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/schema.sql index b3a3f3b158..876d0f8e80 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/schema.sql @@ -1,2 +1,2 @@ CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; -CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT "baz" $$ LANGUAGE sql; \ No newline at end of file +CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT 'baz' $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/schema.sql index 29bf454622..928b1302bf 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/schema.sql @@ -1,5 +1,5 @@ CREATE TABLE foo ( - id uuid PRIMARY KEY, + id uuid NOT NULL, other_id uuid NOT NULL ) PARTITION BY HASH (other_id); diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/schema.sql index 29bf454622..928b1302bf 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/schema.sql @@ -1,5 +1,5 @@ CREATE TABLE foo ( - id uuid PRIMARY KEY, + id uuid NOT NULL, other_id uuid NOT NULL ) PARTITION BY HASH (other_id); diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/schema.sql index 29bf454622..928b1302bf 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/schema.sql @@ -1,5 +1,5 @@ CREATE TABLE foo ( - id uuid PRIMARY KEY, + id uuid NOT NULL, other_id uuid NOT NULL ) PARTITION BY HASH (other_id); diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/schema.sql index 8553bb9e05..0b9d918da0 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/schema.sql @@ -1,3 +1,3 @@ CREATE SCHEMA foo; CREATE TABLE foo.bar (baz text); -DROP SCHEMA foo; +DROP SCHEMA foo CASCADE; diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/schema.sql index 8553bb9e05..0b9d918da0 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/schema.sql @@ -1,3 +1,3 @@ CREATE SCHEMA foo; CREATE TABLE foo.bar (baz text); -DROP SCHEMA foo; +DROP SCHEMA foo CASCADE; diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/schema.sql index 8553bb9e05..0b9d918da0 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/schema.sql @@ -1,3 +1,3 @@ CREATE SCHEMA foo; CREATE TABLE foo.bar (baz text); -DROP SCHEMA foo; +DROP SCHEMA foo CASCADE; diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go index 67b70f58b5..1c67a79a24 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go @@ -8,6 +8,14 @@ import ( "database/sql" ) +type New struct { + Val sql.NullInt32 +} + +type Old struct { + Val sql.NullInt32 +} + type PgTempMigrate struct { Val sql.NullInt32 } diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/schema.sql index 23a15e7842..c44b7f807a 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/schema.sql @@ -1,3 +1,5 @@ +CREATE TABLE old (val SERIAL); +CREATE TABLE new (val SERIAL); CREATE TABLE pg_temp.migrate (val SERIAL); INSERT INTO pg_temp.migrate (val) SELECT val FROM old; -INSERT INTO new (val) SELECT val FROM pg_temp.migrate; \ No newline at end of file +INSERT INTO new (val) SELECT val FROM pg_temp.migrate; diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go index ad17aded29..1d4caa30e6 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go @@ -8,6 +8,14 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) +type New struct { + Val pgtype.Int4 +} + +type Old struct { + Val pgtype.Int4 +} + type PgTempMigrate struct { Val pgtype.Int4 } diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/schema.sql index 23a15e7842..c44b7f807a 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/schema.sql @@ -1,3 +1,5 @@ +CREATE TABLE old (val SERIAL); +CREATE TABLE new (val SERIAL); CREATE TABLE pg_temp.migrate (val SERIAL); INSERT INTO pg_temp.migrate (val) SELECT val FROM old; -INSERT INTO new (val) SELECT val FROM pg_temp.migrate; \ No newline at end of file +INSERT INTO new (val) SELECT val FROM pg_temp.migrate; diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go index 67b70f58b5..1c67a79a24 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go @@ -8,6 +8,14 @@ import ( "database/sql" ) +type New struct { + Val sql.NullInt32 +} + +type Old struct { + Val sql.NullInt32 +} + type PgTempMigrate struct { Val sql.NullInt32 } diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/schema.sql index 23a15e7842..c44b7f807a 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/schema.sql @@ -1,3 +1,5 @@ +CREATE TABLE old (val SERIAL); +CREATE TABLE new (val SERIAL); CREATE TABLE pg_temp.migrate (val SERIAL); INSERT INTO pg_temp.migrate (val) SELECT val FROM old; -INSERT INTO new (val) SELECT val FROM pg_temp.migrate; \ No newline at end of file +INSERT INTO new (val) SELECT val FROM pg_temp.migrate; diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/func_return/postgresql/pgx/v4/schema.sql index 5626061d44..adc43acdb6 100644 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/func_return/postgresql/pgx/v4/schema.sql @@ -1,9 +1,11 @@ CREATE TABLE users ( - id integer, - first_name varchar(255) NOT NULL + id integer, + first_name varchar(255) NOT NULL ); -CREATE FUNCTION users_func() RETURNS SETOF users AS $func$ BEGIN QUERY -SELECT * -FROM users -END $func$ LANGUAGE plpgsql; +CREATE FUNCTION users_func() RETURNS SETOF users AS $func$ + BEGIN + SELECT * + FROM users; + END; +$func$ LANGUAGE plpgsql; diff --git a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/func_return/postgresql/pgx/v5/schema.sql index 5626061d44..adc43acdb6 100644 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/func_return/postgresql/pgx/v5/schema.sql @@ -1,9 +1,11 @@ CREATE TABLE users ( - id integer, - first_name varchar(255) NOT NULL + id integer, + first_name varchar(255) NOT NULL ); -CREATE FUNCTION users_func() RETURNS SETOF users AS $func$ BEGIN QUERY -SELECT * -FROM users -END $func$ LANGUAGE plpgsql; +CREATE FUNCTION users_func() RETURNS SETOF users AS $func$ + BEGIN + SELECT * + FROM users; + END; +$func$ LANGUAGE plpgsql; diff --git a/internal/endtoend/testdata/func_return/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/func_return/postgresql/stdlib/schema.sql index 07bd25160f..adc43acdb6 100644 --- a/internal/endtoend/testdata/func_return/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/func_return/postgresql/stdlib/schema.sql @@ -3,7 +3,9 @@ CREATE TABLE users ( first_name varchar(255) NOT NULL ); -CREATE FUNCTION users_func() RETURNS SETOF users AS $func$ BEGIN QUERY -SELECT * -FROM users -END $func$ LANGUAGE plpgsql; \ No newline at end of file +CREATE FUNCTION users_func() RETURNS SETOF users AS $func$ + BEGIN + SELECT * + FROM users; + END; +$func$ LANGUAGE plpgsql; diff --git a/internal/endtoend/testdata/hstore/pgx/v4/hstore.sql b/internal/endtoend/testdata/hstore/pgx/v4/hstore.sql index ff91ac0291..5299011de6 100644 --- a/internal/endtoend/testdata/hstore/pgx/v4/hstore.sql +++ b/internal/endtoend/testdata/hstore/pgx/v4/hstore.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS hstore; + CREATE TABLE foo ( bar hstore NOT NULL, baz hstore diff --git a/internal/endtoend/testdata/hstore/pgx/v5/hstore.sql b/internal/endtoend/testdata/hstore/pgx/v5/hstore.sql index ff91ac0291..5299011de6 100644 --- a/internal/endtoend/testdata/hstore/pgx/v5/hstore.sql +++ b/internal/endtoend/testdata/hstore/pgx/v5/hstore.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS hstore; + CREATE TABLE foo ( bar hstore NOT NULL, baz hstore diff --git a/internal/endtoend/testdata/hstore/stdlib/hstore.sql b/internal/endtoend/testdata/hstore/stdlib/hstore.sql index ff91ac0291..5299011de6 100644 --- a/internal/endtoend/testdata/hstore/stdlib/hstore.sql +++ b/internal/endtoend/testdata/hstore/stdlib/hstore.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS hstore; + CREATE TABLE foo ( bar hstore NOT NULL, baz hstore diff --git a/internal/endtoend/testdata/identifier_dollar_sign/query.sql b/internal/endtoend/testdata/identifier_dollar_sign/query.sql index ee805d9459..fc5ceffca4 100644 --- a/internal/endtoend/testdata/identifier_dollar_sign/query.sql +++ b/internal/endtoend/testdata/identifier_dollar_sign/query.sql @@ -1,4 +1,5 @@ -CREATE FUNCTION f$n() RETURNS integer AS 'SELECT 1'; +CREATE FUNCTION f$n() RETURNS integer + AS $$ SELECT 1 $$ LANGUAGE SQL; -- name: Fn :one SELECT f$n(); diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/query.sql index 69785fa1fd..df3a0a5e55 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/query.sql @@ -1,4 +1,4 @@ -CREATE TABLE foo (id serial not null); +CREATE TABLE foo (id serial not null unique); CREATE TABLE bar (id serial not null references foo(id), title text); -- name: AliasJoin :many diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/query.sql index 69785fa1fd..df3a0a5e55 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/query.sql @@ -1,4 +1,4 @@ -CREATE TABLE foo (id serial not null); +CREATE TABLE foo (id serial not null unique); CREATE TABLE bar (id serial not null references foo(id), title text); -- name: AliasJoin :many diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_alias/postgresql/stdlib/query.sql index 69785fa1fd..df3a0a5e55 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/query.sql @@ -1,4 +1,4 @@ -CREATE TABLE foo (id serial not null); +CREATE TABLE foo (id serial not null unique); CREATE TABLE bar (id serial not null references foo(id), title text); -- name: AliasJoin :many diff --git a/internal/endtoend/testdata/join_full/postgresql/query.sql b/internal/endtoend/testdata/join_full/postgresql/query.sql index 76abe8a07c..320cf9c25a 100644 --- a/internal/endtoend/testdata/join_full/postgresql/query.sql +++ b/internal/endtoend/testdata/join_full/postgresql/query.sql @@ -1,8 +1,8 @@ +CREATE TABLE bar (id serial not null unique); CREATE TABLE foo (id serial not null, bar_id int references bar(id)); -CREATE TABLE bar (id serial not null); -- name: FullJoin :many SELECT f.id, f.bar_id, b.id FROM foo f FULL OUTER JOIN bar b ON b.id = f.bar_id -WHERE f.id = $1; \ No newline at end of file +WHERE f.id = $1; diff --git a/internal/endtoend/testdata/join_right/postgresql/query.sql b/internal/endtoend/testdata/join_right/postgresql/query.sql index f70c29dd05..3ca68e7d9c 100644 --- a/internal/endtoend/testdata/join_right/postgresql/query.sql +++ b/internal/endtoend/testdata/join_right/postgresql/query.sql @@ -1,8 +1,8 @@ +CREATE TABLE bar (id serial not null unique); CREATE TABLE foo (id serial not null, bar_id int references bar(id)); -CREATE TABLE bar (id serial not null); -- name: RightJoin :many SELECT f.id, f.bar_id, b.id FROM foo f RIGHT JOIN bar b ON b.id = f.bar_id -WHERE f.id = $1; \ No newline at end of file +WHERE f.id = $1; diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/query.sql index c9f0a8557b..6689de6d33 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/query.sql @@ -1,5 +1,5 @@ CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); +CREATE TABLE foo (id serial not null, bar serial); -- name: TableName :one SELECT foo.id diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/query.sql index c9f0a8557b..6689de6d33 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/query.sql @@ -1,5 +1,5 @@ CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); +CREATE TABLE foo (id serial not null, bar serial); -- name: TableName :one SELECT foo.id diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/query.sql b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/query.sql index c9f0a8557b..6689de6d33 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/query.sql @@ -1,5 +1,5 @@ CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); +CREATE TABLE foo (id serial not null, bar serial); -- name: TableName :one SELECT foo.id diff --git a/internal/endtoend/testdata/multischema/pgx/v4/query.sql b/internal/endtoend/testdata/multischema/pgx/v4/query.sql index 10ea52a108..926eec234b 100644 --- a/internal/endtoend/testdata/multischema/pgx/v4/query.sql +++ b/internal/endtoend/testdata/multischema/pgx/v4/query.sql @@ -1,5 +1,5 @@ CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); +CREATE TABLE foo (id serial not null, bar serial); -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multischema/pgx/v5/query.sql b/internal/endtoend/testdata/multischema/pgx/v5/query.sql index 10ea52a108..926eec234b 100644 --- a/internal/endtoend/testdata/multischema/pgx/v5/query.sql +++ b/internal/endtoend/testdata/multischema/pgx/v5/query.sql @@ -1,5 +1,5 @@ CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); +CREATE TABLE foo (id serial not null, bar serial); -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multischema/stdlib/query.sql b/internal/endtoend/testdata/multischema/stdlib/query.sql index 10ea52a108..926eec234b 100644 --- a/internal/endtoend/testdata/multischema/stdlib/query.sql +++ b/internal/endtoend/testdata/multischema/stdlib/query.sql @@ -1,5 +1,5 @@ CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); +CREATE TABLE foo (id serial not null, bar serial); -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query.sql index bd444c6987..089de5d055 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query.sql @@ -3,9 +3,9 @@ CREATE TABLE authors ( id BIGSERIAL PRIMARY KEY, name text NOT NULL, bio text, - tags string[] + tags text[] ); -- name: GetAuthor :one SELECT * FROM authors -WHERE id = $1 LIMIT 1; \ No newline at end of file +WHERE id = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query.sql index bd444c6987..089de5d055 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query.sql @@ -3,9 +3,9 @@ CREATE TABLE authors ( id BIGSERIAL PRIMARY KEY, name text NOT NULL, bio text, - tags string[] + tags text[] ); -- name: GetAuthor :one SELECT * FROM authors -WHERE id = $1 LIMIT 1; \ No newline at end of file +WHERE id = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query.sql b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query.sql index bd444c6987..089de5d055 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query.sql @@ -3,9 +3,9 @@ CREATE TABLE authors ( id BIGSERIAL PRIMARY KEY, name text NOT NULL, bio text, - tags string[] + tags text[] ); -- name: GetAuthor :one SELECT * FROM authors -WHERE id = $1 LIMIT 1; \ No newline at end of file +WHERE id = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/schema.sql index 04551110f3..68d2f8375f 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/schema.sql @@ -2,7 +2,7 @@ CREATE TABLE foo ( id uuid NOT NULL, other_id uuid NOT NULL, age integer, - balance double, + balance double precision, bio text, about text ); @@ -12,7 +12,7 @@ CREATE TABLE bar ( other_id uuid NOT NULL, more_id uuid NOT NULL, age integer, - balance double, + balance double precision, bio text, about text ); diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/schema.sql index 04551110f3..68d2f8375f 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/schema.sql @@ -2,7 +2,7 @@ CREATE TABLE foo ( id uuid NOT NULL, other_id uuid NOT NULL, age integer, - balance double, + balance double precision, bio text, about text ); @@ -12,7 +12,7 @@ CREATE TABLE bar ( other_id uuid NOT NULL, more_id uuid NOT NULL, age integer, - balance double, + balance double precision, bio text, about text ); diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/schema.sql index 4e0d1f5af7..6e33abfeb1 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/schema.sql @@ -2,7 +2,7 @@ CREATE TABLE foo ( id uuid NOT NULL, other_id uuid NOT NULL, age integer, - balance double, + balance double precision, bio text, about text ); diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql b/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql index f6ec96af94..5e767e562a 100644 --- a/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; + CREATE TABLE public.accounts ( id uuid DEFAULT public.uuid_generate_v4() NOT NULL, state character varying @@ -17,4 +19,4 @@ FROM accounts a INNER JOIN users_accounts ua ON a.id = ua.id2 WHERE - a.id = @account_id; \ No newline at end of file + a.id = @account_id; diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/schema.sql index e85e75f37a..5f539d7a14 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/schema.sql @@ -1,7 +1,10 @@ +CREATE TABLE vampires ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid () +); + CREATE TABLE memories ( id uuid PRIMARY KEY DEFAULT gen_random_uuid (), vampire_id uuid REFERENCES vampires (id) NOT NULL, created_at timestamp NOT NULL DEFAULT NOW(), updated_at timestamp ); - diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/schema.sql index e85e75f37a..5f539d7a14 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/schema.sql @@ -1,7 +1,10 @@ +CREATE TABLE vampires ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid () +); + CREATE TABLE memories ( id uuid PRIMARY KEY DEFAULT gen_random_uuid (), vampire_id uuid REFERENCES vampires (id) NOT NULL, created_at timestamp NOT NULL DEFAULT NOW(), updated_at timestamp ); - diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/unnest/postgresql/stdlib/schema.sql index 1780ad7ad3..5f539d7a14 100644 --- a/internal/endtoend/testdata/unnest/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/schema.sql @@ -1,3 +1,7 @@ +CREATE TABLE vampires ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid () +); + CREATE TABLE memories ( id uuid PRIMARY KEY DEFAULT gen_random_uuid (), vampire_id uuid REFERENCES vampires (id) NOT NULL,