Skip to content

Commit 2f615ea

Browse files
committed
Split atx.sql test
1 parent e0ddf66 commit 2f615ea

File tree

7 files changed

+53
-199
lines changed

7 files changed

+53
-199
lines changed

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17924,7 +17924,7 @@ fi
1792417924

1792517925

1792617926

17927-
ac_config_files="$ac_config_files GNUmakefile src/Makefile.global src/test/regress/sql/atx.sql src/test/regress/expected/atx.out"
17927+
ac_config_files="$ac_config_files GNUmakefile src/Makefile.global"
1792817928

1792917929

1793017930
ac_config_links="$ac_config_links src/backend/port/dynloader.c:src/backend/port/dynloader/${template}.c src/backend/port/pg_sema.c:${SEMA_IMPLEMENTATION} src/backend/port/pg_shmem.c:${SHMEM_IMPLEMENTATION} src/include/dynloader.h:src/backend/port/dynloader/${template}.h src/include/pg_config_os.h:src/include/port/${template}.h src/Makefile.port:src/makefiles/Makefile.${template}"

configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2297,7 +2297,7 @@ AC_SUBST(vpath_build)
22972297

22982298
AC_SUBST(PGPRO_VERSION)
22992299

2300-
AC_CONFIG_FILES([GNUmakefile src/Makefile.global src/test/regress/sql/atx.sql src/test/regress/expected/atx.out])
2300+
AC_CONFIG_FILES([GNUmakefile src/Makefile.global])
23012301

23022302
AC_CONFIG_LINKS([
23032303
src/backend/port/dynloader.c:src/backend/port/dynloader/${template}.c

src/pl/plpython/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ REGRESS = \
9090
plpython_quote \
9191
plpython_composite \
9292
plpython_subtransaction \
93-
plpython_drop
93+
plpython_drop \
94+
plpython_atx
9495

9596
REGRESS_PLPYTHON3_MANGLE := $(REGRESS)
9697

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
CREATE EXTENSION plpythonu;
2+
create table atx_test(a text, b int);
3+
create or replace function pythonomous() returns void as $$
4+
plpy.execute("insert into atx_test values ('asd', 123)")
5+
6+
try:
7+
with plpy.autonomous():
8+
plpy.execute("insert into atx_test values ('bsd', 456)")
9+
except (plpy.SPIError, e):
10+
print("error: %s" % e.args)
11+
12+
plpy.execute("insert into atx_test values ('csd', 'csd')")
13+
$$ LANGUAGE plpythonu;
14+
select pythonomous();
15+
ERROR: spiexceptions.InvalidTextRepresentation: invalid input syntax for integer: "csd"
16+
LINE 1: insert into atx_test values ('csd', 'csd')
17+
^
18+
QUERY: insert into atx_test values ('csd', 'csd')
19+
CONTEXT: Traceback (most recent call last):
20+
PL/Python function "pythonomous", line 10, in <module>
21+
plpy.execute("insert into atx_test values ('csd', 'csd')")
22+
PL/Python function "pythonomous"
23+
select * from atx_test; -- you should see (bsd, 456)
24+
a | b
25+
-----+-----
26+
bsd | 456
27+
(1 row)
28+
29+
drop table atx_test;

src/pl/plpython/sql/plpython_atx.sql

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CREATE EXTENSION plpythonu;
2+
3+
create table atx_test(a text, b int);
4+
5+
create or replace function pythonomous() returns void as $$
6+
plpy.execute("insert into atx_test values ('asd', 123)")
7+
8+
try:
9+
with plpy.autonomous():
10+
plpy.execute("insert into atx_test values ('bsd', 456)")
11+
except (plpy.SPIError, e):
12+
print("error: %s" % e.args)
13+
14+
plpy.execute("insert into atx_test values ('csd', 'csd')")
15+
$$ LANGUAGE plpythonu;
16+
17+
select pythonomous();
18+
select * from atx_test; -- you should see (bsd, 456)
19+
20+
drop table atx_test;

src/test/regress/expected/atx.out.in renamed to src/test/regress/results/atx.out

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -163,35 +163,5 @@ select tid, table_name, action, old_data, new_data, query from atx_actions;
163163
4 | atx_test | UPDATE | (hello,world) | (goodbye,world) | update atx_test set a = 'goodbye' where a = 'hello';
164164
(4 rows)
165165

166-
--- plpythonu ---
167-
create extension if not exists plpython@python_majorversion@u;
168-
drop table atx_test;
169-
create table atx_test(a text, b int);
170-
create or replace function pythonomous() returns void as $$
171-
plpy.execute("insert into atx_test values ('asd', 123)")
172-
173-
try:
174-
with plpy.autonomous():
175-
plpy.execute("insert into atx_test values ('bsd', 456)")
176-
except (plpy.SPIError, e):
177-
print("error: %s" % e.args)
178-
179-
plpy.execute("insert into atx_test values ('csd', 'csd')")
180-
$$ language plpython@python_majorversion@u;
181-
select pythonomous();
182-
ERROR: spiexceptions.InvalidTextRepresentation: invalid input syntax for integer: "csd"
183-
LINE 1: insert into atx_test values ('csd', 'csd')
184-
^
185-
QUERY: insert into atx_test values ('csd', 'csd')
186-
CONTEXT: Traceback (most recent call last):
187-
PL/Python function "pythonomous", line 10, in <module>
188-
plpy.execute("insert into atx_test values ('csd', 'csd')")
189-
PL/Python function "pythonomous"
190-
select * from atx_test; -- you should see (bsd, 456)
191-
a | b
192-
-----+-----
193-
bsd | 456
194-
(1 row)
195-
196166
drop table atx_test;
197167
drop table atx_actions;

src/test/regress/sql/atx.sql.in

Lines changed: 0 additions & 166 deletions
This file was deleted.

0 commit comments

Comments
 (0)