-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
CREATE EXTENSION IF NOT EXISTS citext; | ||
|
||
CREATE TABLE foo ( | ||
bar citext, | ||
bat citext not null | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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[]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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[]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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[]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
CREATE TABLE venues (id SERIAL PRIMARY KEY); | ||
ALTER TABLE venues DROP CONSTRAINT venues_id_pkey; | ||
ALTER TABLE venues DROP CONSTRAINT venues_pkey; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
CREATE TABLE venues (id SERIAL PRIMARY KEY); | ||
ALTER TABLE venues DROP CONSTRAINT venues_id_pkey; | ||
ALTER TABLE venues DROP CONSTRAINT venues_pkey; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
CREATE TABLE venues (id SERIAL PRIMARY KEY); | ||
ALTER TABLE venues DROP CONSTRAINT venues_id_pkey; | ||
ALTER TABLE venues DROP CONSTRAINT venues_pkey; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
CREATE TABLE foo (bar text); | ||
ALTER TABLE foo ALTER bar SET DATA TYPE bool; | ||
ALTER TABLE foo ALTER bar SET DATA TYPE bool USING bar::boolean; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
CREATE TABLE foo (bar text); | ||
ALTER TABLE foo ALTER bar SET DATA TYPE bool; | ||
ALTER TABLE foo ALTER bar SET DATA TYPE bool USING bar::boolean; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
CREATE TABLE foo (bar text); | ||
ALTER TABLE foo ALTER bar SET DATA TYPE bool; | ||
ALTER TABLE foo ALTER bar SET DATA TYPE bool USING bar::boolean; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
CREATE FUNCTION foo(bar TEXT, baz TEXT="baz") RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; | ||
CREATE FUNCTION foo(bar TEXT, baz TEXT='baz') RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
CREATE FUNCTION foo(bar TEXT, baz TEXT="baz") RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; | ||
CREATE FUNCTION foo(bar TEXT, baz TEXT='baz') RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
CREATE FUNCTION foo(bar TEXT, baz TEXT="baz") RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; | ||
CREATE FUNCTION foo(bar TEXT, baz TEXT='baz') RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT 'baz' $$ LANGUAGE sql; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT 'baz' $$ LANGUAGE sql; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT 'baz' $$ LANGUAGE sql; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
CREATE SCHEMA foo; | ||
CREATE TABLE foo.bar (baz text); | ||
DROP SCHEMA foo; | ||
DROP SCHEMA foo CASCADE; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
CREATE SCHEMA foo; | ||
CREATE TABLE foo.bar (baz text); | ||
DROP SCHEMA foo; | ||
DROP SCHEMA foo CASCADE; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
CREATE SCHEMA foo; | ||
CREATE TABLE foo.bar (baz text); | ||
DROP SCHEMA foo; | ||
DROP SCHEMA foo CASCADE; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
INSERT INTO new (val) SELECT val FROM pg_temp.migrate; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
INSERT INTO new (val) SELECT val FROM pg_temp.migrate; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
INSERT INTO new (val) SELECT val FROM pg_temp.migrate; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
CREATE EXTENSION IF NOT EXISTS hstore; | ||
|
||
CREATE TABLE foo ( | ||
bar hstore NOT NULL, | ||
baz hstore | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
CREATE EXTENSION IF NOT EXISTS hstore; | ||
|
||
CREATE TABLE foo ( | ||
bar hstore NOT NULL, | ||
baz hstore | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
CREATE EXTENSION IF NOT EXISTS hstore; | ||
|
||
CREATE TABLE foo ( | ||
bar hstore NOT NULL, | ||
baz hstore | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |