Skip to content

Commit 4ded1f6

Browse files
committed
Add some old deparse versions
1 parent dcbec76 commit 4ded1f6

21 files changed

Lines changed: 54389 additions & 18 deletions

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM catthehacker/ubuntu:act-latest
2+
3+
RUN sudo apt-get remove -y postgresql-*
4+
RUN install -d /usr/share/postgresql-common/pgdg
5+
RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
6+
RUN sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
7+
RUN apt-get update
8+
RUN apt-get install -y "postgresql-15" "postgresql-server-dev-15" "postgresql-15-pglogical"
9+
RUN pg_createcluster -p 5433 15 test
10+
RUN sh -c 'echo "shared_preload_libraries = 'pglogical'\nwal_level = 'logical'" >> /etc/postgresql/15/test/postgresql.conf'

Dockerfile.test

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ubuntu:noble
2+
3+
RUN apt-get update && apt-get install -y curl lsb-release gnupg build-essential
4+
RUN install -d /usr/share/postgresql-common/pgdg
5+
RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
6+
RUN sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
7+
RUN apt-get update
8+
ARG PGVERSION=15
9+
RUN apt-get install -y "postgresql-${PGVERSION}" "postgresql-server-dev-${PGVERSION}" "postgresql-${PGVERSION}-pglogical"
10+
RUN pg_createcluster -p 5433 ${PGVERSION} test
11+
RUN sh -c 'echo "shared_preload_libraries = 'pglogical'\nwal_level = 'logical'" >> /etc/postgresql/${PGVERSION}/test/postgresql.conf'
12+
COPY . /usr/src/ext
13+
RUN cd /usr/src/ext && make && make install

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ DATA = pgl_ddl_deploy--1.0.sql pgl_ddl_deploy--1.0--1.1.sql \
1414
pgl_ddl_deploy--2.4.sql
1515
MODULES = ddl_deparse
1616
MODULE_big = pgl_ddl_deploy
17-
OBJS = postgres_deparse.o pgl_ddl_deploy.o
17+
OBJS = src/postgres_deparse.11.o \
18+
src/postgres_deparse.12.o \
19+
src/postgres_deparse.13.o \
20+
src/postgres_deparse.14.o \
21+
src/postgres_deparse.15.o \
22+
src/postgres_deparse.16.o \
23+
src/postgres_deparse.17.o \
24+
src/postgres_deparse.18.o \
25+
src/pgl_ddl_deploy.o
1826

1927
REGRESS := 01_create_ext 02_setup 03_add_configs 04_deploy 04_deploy_update \
2028
05_allowed 06_multi 07_edges 08_ignored \

ddl_deparse.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ get_altertable_subcmdinfo(PG_FUNCTION_ARGS)
104104
strtype = "ADD OIDS";
105105
break;
106106
case AT_AddOidsRecurse:
107-
strtype = "ADD OIDS (and recurse)";
107+
strtype = "ADD OIDS";
108108
break;
109109
#endif
110110
#if PG_VERSION_NUM >= 120000 && PG_VERSION_NUM < 180000
@@ -119,19 +119,19 @@ get_altertable_subcmdinfo(PG_FUNCTION_ARGS)
119119
#endif
120120
#if PG_VERSION_NUM < 160000
121121
case AT_AddColumnRecurse:
122-
strtype = "ADD COLUMN (and recurse)";
122+
strtype = "ADD COLUMN";
123123
break;
124124
case AT_DropColumnRecurse:
125-
strtype = "DROP COLUMN (and recurse)";
125+
strtype = "DROP COLUMN";
126126
break;
127127
case AT_AddConstraintRecurse:
128-
strtype = "ADD CONSTRAINT (and recurse)";
128+
strtype = "ADD CONSTRAINT";
129129
break;
130130
case AT_ValidateConstraintRecurse:
131-
strtype = "VALIDATE CONSTRAINT (and recurse)";
131+
strtype = "VALIDATE CONSTRAINT";
132132
break;
133133
case AT_DropConstraintRecurse:
134-
strtype = "DROP CONSTRAINT (and recurse)";
134+
strtype = "DROP CONSTRAINT";
135135
break;
136136
#endif
137137
#if PG_VERSION_NUM >= 170000

expected/20_include_only_repset_tables_4_1.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ LOG: Not processing DDL due to excluded subcommand(s): ENABLE TRIGGER: ALTER TA
4545
-- This contains a tag we want to ignore but we can't separate out the parts - see the warning message
4646
ALTER TABLE special.barz ADD COLUMN foo_id INT REFERENCES special.fooz (id_2);
4747
WARNING: Filtering out more than one subcommand in one ALTER TABLE is not supported.
48-
Allowing to proceed: Rejected: ADD CONSTRAINT (and recurse), SQL: ALTER TABLE special.barz ADD COLUMN foo_id INT REFERENCES special.fooz (id_2);
48+
Allowing to proceed: Rejected: ADD CONSTRAINT, SQL: ALTER TABLE special.barz ADD COLUMN foo_id INT REFERENCES special.fooz (id_2);
4949
ALTER TABLE special.fooz ADD COLUMN bar_id INT;
5050
-- This one should be ignored as well
5151
ALTER TABLE special.fooz ADD CONSTRAINT coolness FOREIGN KEY (bar_id) REFERENCES special.barz (id_3);
52-
LOG: Not processing DDL due to excluded subcommand(s): ADD CONSTRAINT (and recurse): ALTER TABLE special.fooz ADD CONSTRAINT coolness FOREIGN KEY (bar_id) REFERENCES special.barz (id_3);
52+
LOG: Not processing DDL due to excluded subcommand(s): ADD CONSTRAINT: ALTER TABLE special.fooz ADD CONSTRAINT coolness FOREIGN KEY (bar_id) REFERENCES special.barz (id_3);
5353
SELECT c.set_name, ddl_sql_raw, ddl_sql_sent
5454
FROM pgl_ddl_deploy.events e
5555
INNER JOIN pgl_ddl_deploy.set_configs c ON c.id = e.set_config_id

expected/48_include_only_repset_tables_4_1.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ LOG: Not processing DDL due to excluded subcommand(s): ENABLE TRIGGER: ALTER TA
4545
-- This contains a tag we want to ignore but we can't separate out the parts - see the warning message
4646
ALTER TABLE special.barz ADD COLUMN foo_id INT REFERENCES special.fooz (id_2);
4747
WARNING: Filtering out more than one subcommand in one ALTER TABLE is not supported.
48-
Allowing to proceed: Rejected: ADD CONSTRAINT (and recurse), SQL: ALTER TABLE special.barz ADD COLUMN foo_id INT REFERENCES special.fooz (id_2);
48+
Allowing to proceed: Rejected: ADD CONSTRAINT, SQL: ALTER TABLE special.barz ADD COLUMN foo_id INT REFERENCES special.fooz (id_2);
4949
ALTER TABLE special.fooz ADD COLUMN bar_id INT;
5050
-- This one should be ignored as well
5151
ALTER TABLE special.fooz ADD CONSTRAINT coolness FOREIGN KEY (bar_id) REFERENCES special.barz (id_3);
52-
LOG: Not processing DDL due to excluded subcommand(s): ADD CONSTRAINT (and recurse): ALTER TABLE special.fooz ADD CONSTRAINT coolness FOREIGN KEY (bar_id) REFERENCES special.barz (id_3);
52+
LOG: Not processing DDL due to excluded subcommand(s): ADD CONSTRAINT: ALTER TABLE special.fooz ADD CONSTRAINT coolness FOREIGN KEY (bar_id) REFERENCES special.barz (id_3);
5353
SELECT c.set_name, ddl_sql_raw, ddl_sql_sent
5454
FROM pgl_ddl_deploy.events e
5555
INNER JOIN pgl_ddl_deploy.set_configs c ON c.id = e.set_config_id

functions/common_exclude_alter_table_subcommands.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ RETURNS TEXT[] AS
33
$BODY$
44
SELECT ARRAY[
55
'ADD CONSTRAINT',
6-
'ADD CONSTRAINT (and recurse)',
76
'(re) ADD CONSTRAINT',
87
'ALTER CONSTRAINT',
98
'VALIDATE CONSTRAINT',
10-
'VALIDATE CONSTRAINT (and recurse)',
119
'ADD (processed) CONSTRAINT',
1210
'ADD CONSTRAINT (using index)',
1311
'DROP CONSTRAINT',
14-
'DROP CONSTRAINT (and recurse)',
1512
'SET LOGGED',
1613
'SET UNLOGGED',
1714
'SET TABLESPACE',

pgl_ddl_deploy--2.3--2.4.sql

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,39 @@
66
ALTER TABLE pgl_ddl_deploy.set_configs ADD COLUMN include_indexes BOOLEAN NOT NULL DEFAULT FALSE;
77

88

9+
CREATE OR REPLACE FUNCTION pgl_ddl_deploy.common_exclude_alter_table_subcommands()
10+
RETURNS TEXT[] AS
11+
$BODY$
12+
SELECT ARRAY[
13+
'ADD CONSTRAINT',
14+
'(re) ADD CONSTRAINT',
15+
'ALTER CONSTRAINT',
16+
'VALIDATE CONSTRAINT',
17+
'ADD (processed) CONSTRAINT',
18+
'ADD CONSTRAINT (using index)',
19+
'DROP CONSTRAINT',
20+
'SET LOGGED',
21+
'SET UNLOGGED',
22+
'SET TABLESPACE',
23+
'SET RELOPTIONS',
24+
'RESET RELOPTIONS',
25+
'REPLACE RELOPTIONS',
26+
'ENABLE TRIGGER',
27+
'ENABLE TRIGGER (always)',
28+
'ENABLE TRIGGER (replica)',
29+
'DISABLE TRIGGER',
30+
'ENABLE TRIGGER (all)',
31+
'DISABLE TRIGGER (all)',
32+
'ENABLE TRIGGER (user)',
33+
'DISABLE TRIGGER (user)',
34+
'ENABLE RULE',
35+
'ENABLE RULE (always)',
36+
'ENABLE RULE (replica)',
37+
'DISABLE RULE',
38+
'SET OPTIONS']::TEXT[];
39+
$BODY$
40+
LANGUAGE SQL IMMUTABLE;
41+
942
CREATE OR REPLACE FUNCTION pgl_ddl_deploy.rewrite_transaction_safe(p_sql text)
1043
RETURNS text
1144
LANGUAGE c
@@ -313,7 +346,8 @@ WITH vars AS
313346
$BUILD$::TEXT AS shared_mixed_obj_logic,
314347
$BUILD$
315348
-- Filter out purely PG-internal triggers (alas, "pg_event_trigger_dropped_objects" does not expose "tgisinternal", so we must filter by name)
316-
(SELECT * FROM pg_event_trigger_dropped_objects() WHERE address_names[array_upper(address_names, 1)] NOT LIKE 'RI_ConstraintTrigger_a_%' AND address_names[array_upper(address_names, 1)] NOT LIKE 'RI_ConstraintTrigger_c_%')
349+
-- Also filter out toast tables since if there are any non-toast operations the toast ones are almost certainly internally generated
350+
(SELECT * FROM pg_event_trigger_dropped_objects() WHERE address_names[array_upper(address_names, 1)] NOT LIKE 'RI_ConstraintTrigger_a_%' AND address_names[array_upper(address_names, 1)] NOT LIKE 'RI_ConstraintTrigger_c_%' AND schema_name <> 'pg_toast')
317351
$BUILD$::TEXT AS dropped_objects_query,
318352

319353
$BUILD$

pgl_ddl_deploy--2.4.sql

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5172,6 +5172,39 @@ FROM build b;
51725172
ALTER TABLE pgl_ddl_deploy.set_configs ADD COLUMN include_indexes BOOLEAN NOT NULL DEFAULT FALSE;
51735173

51745174

5175+
CREATE OR REPLACE FUNCTION pgl_ddl_deploy.common_exclude_alter_table_subcommands()
5176+
RETURNS TEXT[] AS
5177+
$BODY$
5178+
SELECT ARRAY[
5179+
'ADD CONSTRAINT',
5180+
'(re) ADD CONSTRAINT',
5181+
'ALTER CONSTRAINT',
5182+
'VALIDATE CONSTRAINT',
5183+
'ADD (processed) CONSTRAINT',
5184+
'ADD CONSTRAINT (using index)',
5185+
'DROP CONSTRAINT',
5186+
'SET LOGGED',
5187+
'SET UNLOGGED',
5188+
'SET TABLESPACE',
5189+
'SET RELOPTIONS',
5190+
'RESET RELOPTIONS',
5191+
'REPLACE RELOPTIONS',
5192+
'ENABLE TRIGGER',
5193+
'ENABLE TRIGGER (always)',
5194+
'ENABLE TRIGGER (replica)',
5195+
'DISABLE TRIGGER',
5196+
'ENABLE TRIGGER (all)',
5197+
'DISABLE TRIGGER (all)',
5198+
'ENABLE TRIGGER (user)',
5199+
'DISABLE TRIGGER (user)',
5200+
'ENABLE RULE',
5201+
'ENABLE RULE (always)',
5202+
'ENABLE RULE (replica)',
5203+
'DISABLE RULE',
5204+
'SET OPTIONS']::TEXT[];
5205+
$BODY$
5206+
LANGUAGE SQL IMMUTABLE;
5207+
51755208
CREATE OR REPLACE FUNCTION pgl_ddl_deploy.rewrite_transaction_safe(p_sql text)
51765209
RETURNS text
51775210
LANGUAGE c
@@ -5479,7 +5512,8 @@ WITH vars AS
54795512
$BUILD$::TEXT AS shared_mixed_obj_logic,
54805513
$BUILD$
54815514
-- Filter out purely PG-internal triggers (alas, "pg_event_trigger_dropped_objects" does not expose "tgisinternal", so we must filter by name)
5482-
(SELECT * FROM pg_event_trigger_dropped_objects() WHERE address_names[array_upper(address_names, 1)] NOT LIKE 'RI_ConstraintTrigger_a_%' AND address_names[array_upper(address_names, 1)] NOT LIKE 'RI_ConstraintTrigger_c_%')
5515+
-- Also filter out toast tables since if there are any non-toast operations the toast ones are almost certainly internally generated
5516+
(SELECT * FROM pg_event_trigger_dropped_objects() WHERE address_names[array_upper(address_names, 1)] NOT LIKE 'RI_ConstraintTrigger_a_%' AND address_names[array_upper(address_names, 1)] NOT LIKE 'RI_ConstraintTrigger_c_%' AND schema_name <> 'pg_toast')
54835517
$BUILD$::TEXT AS dropped_objects_query,
54845518

54855519
$BUILD$

pgl_ddl_deploy-sql-maker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ create_update_file_with_header
3737

3838
# Add view and function changes
3939
add_file schema/2.4.sql $update_file
40+
add_file functions/common_exclude_alter_table_subcommands.sql $update_file
4041
add_file functions/rewrite_transaction_safe.sql $update_file
4142
add_file functions/set_tag_defaults.sql $update_file
4243
add_file views/event_trigger_schema.sql $update_file

0 commit comments

Comments
 (0)