Skip to content

Commit 3e7fe52

Browse files
committed
Merge remote-tracking branch 'publicppg/master' into create_table_storage
2 parents d76e1cf + 5e64ad3 commit 3e7fe52

File tree

126 files changed

+3421
-3025
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+3421
-3025
lines changed

contrib/auth_delay/auth_delay.c

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ _PG_init(void)
6767
NULL,
6868
NULL,
6969
NULL);
70+
71+
EmitWarningsOnPlaceholders("auth_delay");
72+
7073
/* Install Hooks */
7174
original_client_auth_hook = ClientAuthentication_hook;
7275
ClientAuthentication_hook = auth_delay_checks;

contrib/dblink/Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ EXTENSION = dblink
1111
DATA = dblink--1.2.sql dblink--1.1--1.2.sql dblink--1.0--1.1.sql
1212
PGFILEDESC = "dblink - connect to other PostgreSQL databases"
1313

14-
REGRESS = paths dblink
14+
REGRESS = dblink
1515
REGRESS_OPTS = --dlpath=$(top_builddir)/src/test/regress
16-
EXTRA_CLEAN = sql/paths.sql expected/paths.out
1716

1817
ifdef USE_PGXS
1918
PG_CONFIG = pg_config

contrib/dblink/expected/.gitignore

-1
This file was deleted.

contrib/dblink/expected/dblink.out

+18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
CREATE EXTENSION dblink;
2+
-- directory paths and dlsuffix are passed to us in environment variables
3+
\getenv abs_srcdir PG_ABS_SRCDIR
4+
\getenv libdir PG_LIBDIR
5+
\getenv dlsuffix PG_DLSUFFIX
6+
\set regresslib :libdir '/regress' :dlsuffix
7+
-- create some functions needed for tests
8+
CREATE FUNCTION setenv(text, text)
9+
RETURNS void
10+
AS :'regresslib', 'regress_setenv'
11+
LANGUAGE C STRICT;
12+
CREATE FUNCTION wait_pid(int)
13+
RETURNS void
14+
AS :'regresslib'
15+
LANGUAGE C STRICT;
16+
\set path :abs_srcdir '/'
17+
\set fnbody 'SELECT setenv(''PGSERVICEFILE'', ' :'path' ' || $1)'
18+
CREATE FUNCTION set_pgservicefile(text) RETURNS void LANGUAGE SQL
19+
AS :'fnbody';
220
-- want context for notices
321
\set SHOW_CONTEXT always
422
CREATE TABLE foo(f1 int, f2 text, f3 text[], primary key (f1,f2));

contrib/dblink/input/paths.source

-14
This file was deleted.

contrib/dblink/output/paths.source

-11
This file was deleted.

contrib/dblink/sql/.gitignore

-1
This file was deleted.

contrib/dblink/sql/dblink.sql

+23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
CREATE EXTENSION dblink;
22

3+
-- directory paths and dlsuffix are passed to us in environment variables
4+
\getenv abs_srcdir PG_ABS_SRCDIR
5+
\getenv libdir PG_LIBDIR
6+
\getenv dlsuffix PG_DLSUFFIX
7+
8+
\set regresslib :libdir '/regress' :dlsuffix
9+
10+
-- create some functions needed for tests
11+
CREATE FUNCTION setenv(text, text)
12+
RETURNS void
13+
AS :'regresslib', 'regress_setenv'
14+
LANGUAGE C STRICT;
15+
16+
CREATE FUNCTION wait_pid(int)
17+
RETURNS void
18+
AS :'regresslib'
19+
LANGUAGE C STRICT;
20+
21+
\set path :abs_srcdir '/'
22+
\set fnbody 'SELECT setenv(''PGSERVICEFILE'', ' :'path' ' || $1)'
23+
CREATE FUNCTION set_pgservicefile(text) RETURNS void LANGUAGE SQL
24+
AS :'fnbody';
25+
326
-- want context for notices
427
\set SHOW_CONTEXT always
528

contrib/file_fdw/Makefile

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ PGFILEDESC = "file_fdw - foreign data wrapper for files"
88

99
REGRESS = file_fdw
1010

11-
EXTRA_CLEAN = sql/file_fdw.sql expected/file_fdw.out
12-
1311
ifdef USE_PGXS
1412
PG_CONFIG = pg_config
1513
PGXS := $(shell $(PG_CONFIG) --pgxs)

contrib/file_fdw/expected/.gitignore

-1
This file was deleted.

contrib/file_fdw/output/file_fdw.source renamed to contrib/file_fdw/expected/file_fdw.out

+40-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
--
22
-- Test foreign-data wrapper file_fdw.
33
--
4+
-- directory paths are passed to us in environment variables
5+
\getenv abs_srcdir PG_ABS_SRCDIR
46
-- Clean up in case a prior regression run failed
57
SET client_min_messages TO 'warning';
68
DROP ROLE IF EXISTS regress_file_fdw_superuser, regress_file_fdw_user, regress_no_priv_user;
@@ -10,6 +12,21 @@ CREATE ROLE regress_file_fdw_user LOGIN; -- has priv and user map
1012
CREATE ROLE regress_no_priv_user LOGIN; -- has priv but no user mapping
1113
-- Install file_fdw
1214
CREATE EXTENSION file_fdw;
15+
-- create function to filter unstable results of EXPLAIN
16+
CREATE FUNCTION explain_filter(text) RETURNS setof text
17+
LANGUAGE plpgsql AS
18+
$$
19+
declare
20+
ln text;
21+
begin
22+
for ln in execute $1
23+
loop
24+
-- Remove the path portion of foreign file names
25+
ln := regexp_replace(ln, 'Foreign File: .*/([a-z.]+)$', 'Foreign File: .../\1');
26+
return next ln;
27+
end loop;
28+
end;
29+
$$;
1330
-- regress_file_fdw_superuser owns fdw-related objects
1431
SET ROLE regress_file_fdw_superuser;
1532
CREATE SERVER file_server FOREIGN DATA WRAPPER file_fdw;
@@ -77,32 +94,36 @@ CREATE FOREIGN TABLE tbl () SERVER file_server OPTIONS (format 'csv', null '
7794
ERROR: COPY null representation cannot use newline or carriage return
7895
CREATE FOREIGN TABLE tbl () SERVER file_server; -- ERROR
7996
ERROR: either filename or program is required for file_fdw foreign tables
97+
\set filename :abs_srcdir '/data/agg.data'
8098
CREATE FOREIGN TABLE agg_text (
8199
a int2 CHECK (a >= 0),
82100
b float4
83101
) SERVER file_server
84-
OPTIONS (format 'text', filename '@abs_srcdir@/data/agg.data', delimiter ' ', null '\N');
102+
OPTIONS (format 'text', filename :'filename', delimiter ' ', null '\N');
85103
GRANT SELECT ON agg_text TO regress_file_fdw_user;
104+
\set filename :abs_srcdir '/data/agg.csv'
86105
CREATE FOREIGN TABLE agg_csv (
87106
a int2,
88107
b float4
89108
) SERVER file_server
90-
OPTIONS (format 'csv', filename '@abs_srcdir@/data/agg.csv', header 'true', delimiter ';', quote '@', escape '"', null '');
109+
OPTIONS (format 'csv', filename :'filename', header 'true', delimiter ';', quote '@', escape '"', null '');
91110
ALTER FOREIGN TABLE agg_csv ADD CHECK (a >= 0);
111+
\set filename :abs_srcdir '/data/agg.bad'
92112
CREATE FOREIGN TABLE agg_bad (
93113
a int2,
94114
b float4
95115
) SERVER file_server
96-
OPTIONS (format 'csv', filename '@abs_srcdir@/data/agg.bad', header 'true', delimiter ';', quote '@', escape '"', null '');
116+
OPTIONS (format 'csv', filename :'filename', header 'true', delimiter ';', quote '@', escape '"', null '');
97117
ALTER FOREIGN TABLE agg_bad ADD CHECK (a >= 0);
98118
-- per-column options tests
119+
\set filename :abs_srcdir '/data/text.csv'
99120
CREATE FOREIGN TABLE text_csv (
100121
word1 text OPTIONS (force_not_null 'true'),
101122
word2 text OPTIONS (force_not_null 'off'),
102123
word3 text OPTIONS (force_null 'true'),
103124
word4 text OPTIONS (force_null 'off')
104125
) SERVER file_server
105-
OPTIONS (format 'text', filename '@abs_srcdir@/data/text.csv', null 'NULL');
126+
OPTIONS (format 'text', filename :'filename', null 'NULL');
106127
SELECT * FROM text_csv; -- ERROR
107128
ERROR: COPY force not null available only in CSV mode
108129
ALTER FOREIGN TABLE text_csv OPTIONS (SET format 'csv');
@@ -176,10 +197,10 @@ ERROR: invalid input syntax for type real: "aaa"
176197
CONTEXT: COPY agg_bad, line 3, column b: "aaa"
177198
-- misc query tests
178199
\t on
179-
EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_csv;
200+
SELECT explain_filter('EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_csv');
180201
Foreign Scan on public.agg_csv
181202
Output: a, b
182-
Foreign File: @abs_srcdir@/data/agg.csv
203+
Foreign File: .../agg.csv
183204

184205
\t off
185206
PREPARE st(int) AS SELECT * FROM agg_csv WHERE a = $1;
@@ -226,11 +247,11 @@ COPY agg_csv FROM STDIN;
226247
ERROR: cannot insert into foreign table "agg_csv"
227248
-- constraint exclusion tests
228249
\t on
229-
EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_csv WHERE a < 0;
250+
SELECT explain_filter('EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_csv WHERE a < 0');
230251
Foreign Scan on public.agg_csv
231252
Output: a, b
232253
Filter: (agg_csv.a < 0)
233-
Foreign File: @abs_srcdir@/data/agg.csv
254+
Foreign File: .../agg.csv
234255

235256
\t off
236257
SELECT * FROM agg_csv WHERE a < 0;
@@ -240,7 +261,7 @@ SELECT * FROM agg_csv WHERE a < 0;
240261

241262
SET constraint_exclusion = 'on';
242263
\t on
243-
EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_csv WHERE a < 0;
264+
SELECT explain_filter('EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_csv WHERE a < 0');
244265
Result
245266
Output: a, b
246267
One-Time Filter: false
@@ -295,8 +316,9 @@ DROP TABLE agg;
295316
-- declarative partitioning tests
296317
SET ROLE regress_file_fdw_superuser;
297318
CREATE TABLE pt (a int, b text) partition by list (a);
319+
\set filename :abs_srcdir '/data/list1.csv'
298320
CREATE FOREIGN TABLE p1 partition of pt for values in (1) SERVER file_server
299-
OPTIONS (format 'csv', filename '@abs_srcdir@/data/list1.csv', delimiter ',');
321+
OPTIONS (format 'csv', filename :'filename', delimiter ',');
300322
CREATE TABLE p2 partition of pt for values in (2);
301323
SELECT tableoid::regclass, * FROM pt;
302324
tableoid | a | b
@@ -317,10 +339,12 @@ SELECT tableoid::regclass, * FROM p2;
317339
----------+---+---
318340
(0 rows)
319341

320-
COPY pt FROM '@abs_srcdir@/data/list2.bad' with (format 'csv', delimiter ','); -- ERROR
342+
\set filename :abs_srcdir '/data/list2.bad'
343+
COPY pt FROM :'filename' with (format 'csv', delimiter ','); -- ERROR
321344
ERROR: cannot insert into foreign table "p1"
322345
CONTEXT: COPY pt, line 2: "1,qux"
323-
COPY pt FROM '@abs_srcdir@/data/list2.csv' with (format 'csv', delimiter ',');
346+
\set filename :abs_srcdir '/data/list2.csv'
347+
COPY pt FROM :'filename' with (format 'csv', delimiter ',');
324348
SELECT tableoid::regclass, * FROM pt;
325349
tableoid | a | b
326350
----------+---+-----
@@ -376,8 +400,9 @@ SELECT tableoid::regclass, * FROM p2;
376400

377401
DROP TABLE pt;
378402
-- generated column tests
403+
\set filename :abs_srcdir '/data/list1.csv'
379404
CREATE FOREIGN TABLE gft1 (a int, b text, c text GENERATED ALWAYS AS ('foo') STORED) SERVER file_server
380-
OPTIONS (format 'csv', filename '@abs_srcdir@/data/list1.csv', delimiter ',');
405+
OPTIONS (format 'csv', filename :'filename', delimiter ',');
381406
SELECT a, c FROM gft1;
382407
a | c
383408
---+--------
@@ -412,11 +437,11 @@ SELECT * FROM agg_text ORDER BY a; -- ERROR
412437
ERROR: permission denied for foreign table agg_text
413438
SET ROLE regress_file_fdw_user;
414439
\t on
415-
EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_text WHERE a > 0;
440+
SELECT explain_filter('EXPLAIN (VERBOSE, COSTS FALSE) SELECT * FROM agg_text WHERE a > 0');
416441
Foreign Scan on public.agg_text
417442
Output: a, b
418443
Filter: (agg_text.a > 0)
419-
Foreign File: @abs_srcdir@/data/agg.data
444+
Foreign File: .../agg.data
420445

421446
\t off
422447
-- file FDW allows foreign tables to be accessed without user mapping

contrib/file_fdw/sql/.gitignore

-1
This file was deleted.

0 commit comments

Comments
 (0)