diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:16:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:16:24 +0000 |
commit | 2a0f262beff32ba86bcb58f3273214e5d0517c09 (patch) | |
tree | 24c0ad10dab36bbd5c22743d3c88c4e0ccd5bc65 /src/interfaces/ecpg/test/sql | |
parent | Releasing progress-linux version 16.2-2~progress7.99u1. (diff) | |
download | postgresql-16-2a0f262beff32ba86bcb58f3273214e5d0517c09.tar.xz postgresql-16-2a0f262beff32ba86bcb58f3273214e5d0517c09.zip |
Merging upstream version 16.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/interfaces/ecpg/test/sql')
-rw-r--r-- | src/interfaces/ecpg/test/sql/Makefile | 3 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/sql/define.pgc | 25 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/sql/define_prelim.pgc | 6 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/sql/meson.build | 1 |
4 files changed, 35 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/test/sql/Makefile b/src/interfaces/ecpg/test/sql/Makefile index d8213b2..6032762 100644 --- a/src/interfaces/ecpg/test/sql/Makefile +++ b/src/interfaces/ecpg/test/sql/Makefile @@ -33,5 +33,8 @@ TESTS = array array.c \ all: $(TESTS) +define.c: define.pgc define_prelim.pgc $(ECPG_TEST_DEPENDENCIES) + $(ECPG) -DCMDLINESYM=123 -o $@ $(srcdir)/define_prelim.pgc $< + oldexec.c: oldexec.pgc $(ECPG_TEST_DEPENDENCIES) $(ECPG) -r questionmarks -o $@ $< diff --git a/src/interfaces/ecpg/test/sql/define.pgc b/src/interfaces/ecpg/test/sql/define.pgc index ed58a4b..83f328d 100644 --- a/src/interfaces/ecpg/test/sql/define.pgc +++ b/src/interfaces/ecpg/test/sql/define.pgc @@ -53,6 +53,31 @@ int main(void) exec sql SET TIMEZONE TO TZVAR; exec sql endif; + /* test handling of a macro defined on the command line */ + exec sql select CMDLINESYM INTO :i; + printf("original CMDLINESYM: %d\n", i); + + exec sql define CMDLINESYM 42; + + exec sql select CMDLINESYM INTO :i; + printf("redefined CMDLINESYM: %d\n", i); + + exec sql define CMDLINESYM 43; + + exec sql select CMDLINESYM INTO :i; + printf("redefined CMDLINESYM: %d\n", i); + + exec sql undef CMDLINESYM; + + exec sql ifdef CMDLINESYM; + exec sql insert into test values (NUMBER, 'no string'); + exec sql endif; + + /* this macro should not have carried over from define_prelim.pgc */ + exec sql ifdef NONCMDLINESYM; + exec sql insert into test values (NUMBER, 'no string'); + exec sql endif; + exec sql disconnect; return 0; } diff --git a/src/interfaces/ecpg/test/sql/define_prelim.pgc b/src/interfaces/ecpg/test/sql/define_prelim.pgc new file mode 100644 index 0000000..7a984f7 --- /dev/null +++ b/src/interfaces/ecpg/test/sql/define_prelim.pgc @@ -0,0 +1,6 @@ +/* + * Test that the effects of these commands don't carry over to the next + * file named on the ecpg command line. + */ +exec sql define CMDLINESYM 999; +exec sql define NONCMDLINESYM 1234; diff --git a/src/interfaces/ecpg/test/sql/meson.build b/src/interfaces/ecpg/test/sql/meson.build index f4c9418..e2a5ca2 100644 --- a/src/interfaces/ecpg/test/sql/meson.build +++ b/src/interfaces/ecpg/test/sql/meson.build @@ -30,6 +30,7 @@ pgc_files = [ ] pgc_extra_flags = { + 'define': ['-DCMDLINESYM=123', files('define_prelim.pgc')], 'oldexec': ['-r', 'questionmarks'], } |