Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
27583e1
Fix data inconsistency between publisher and subscriber.
Jun 16, 2022
2c169f0
Fix partition table's REPLICA IDENTITY checking on the subscriber.
Jun 21, 2022
393830e
Fix stale values in partition map entries on subscribers.
Jun 21, 2022
7894998
Fix SPI's handling of errors during transaction commit.
tglsfdc Jun 22, 2022
af3346e
doc: clarify wording about phantom reads
bmomjian Jun 22, 2022
6ce1d00
doc: improve wording of plpgsql RAISE format text
bmomjian Jun 22, 2022
68c3dd3
Fix memory leak due to LogicalRepRelMapEntry.attrmap.
Jun 23, 2022
672b74c
For PostgreSQL::Test compatibility, alias entire package symbol tables.
nmisch Jun 25, 2022
b5a4ebf
Backport: Ban role pg_signal_backend from more superuser backend type…
reshke Feb 17, 2026
3792fd3
Fix PostgreSQL::Test aliasing for Perl v5.10.1.
nmisch Jun 25, 2022
0f77a26
Don't trust signalfd() on illumos.
macdice Jun 25, 2022
0417b38
Fix visibility check when XID is committed in CLOG but not in procarray.
hlinnaka Jun 27, 2022
0d80379
ecpglib: call newlocale() once per process.
nmisch Jul 2, 2022
dcd6f3d
Fix previous commit's ecpg_clocale for ppc Darwin.
nmisch Jul 3, 2022
9dcc89b
libpq: Improve idle state handling in pipeline mode
alvherre Jul 5, 2022
e86b72b
Fix pg_upgrade to detect non-upgradable anyarray usages.
tglsfdc Jul 5, 2022
e0bb482
Tighten pg_upgrade's new check for non-upgradable anyarray usages.
tglsfdc Jul 5, 2022
ee0e5c5
fix ecpglib patch
reshke Feb 7, 2026
2156d96
doc: add examples for array_length() and jsonb_array_length()
bmomjian Jul 9, 2022
d7f9a1a
doc: Fix inconsistent quotes in some jsonb fields
michaelpq Jul 11, 2022
b16345b
CREATE INDEX: use the original userid for more ACL checks.
nmisch Jun 25, 2022
a0dc990
Fix for ace9973867c to work in MPP
reshke Feb 15, 2026
898de9b
Remove bogus loop in single-iteration code (#1580)
reshke Feb 25, 2026
43b7963
Invent qsort_interruptible().
tglsfdc Jul 12, 2022
3d23d4d
Plug memory leak
alvherre Jul 13, 2022
8a29306
doc: mention the pg_locks lock names in parentheses
bmomjian Jul 14, 2022
ac550ca
doc: mention that INSERT can block because of unique indexes
bmomjian Jul 14, 2022
12d508e
doc: clarify that "excluded" ON CONFLICT is a single row
bmomjian Jul 14, 2022
3a9d019
doc: clarify the behavior of identically-named savepoints
bmomjian Jul 14, 2022
00853cf
doc: add documentation about ecpg Oracle-compatibility mode
bmomjian Jul 14, 2022
cdd6652
pg_upgrade doc: mention that replication slots must be recreated
bmomjian Jul 14, 2022
133d820
doc: clarify how dropping of extensions affects dependent objs.
bmomjian Jul 14, 2022
b3bbe43
docs: make monitoring "phases" table titles consistent
bmomjian Jul 15, 2022
e5378a2
Clarify that pg_dump takes ACCESS SHARE lock
j-naylor Jul 1, 2022
fb07dda
Fix omissions in support for the "regcollation" type.
tglsfdc Jul 17, 2022
c1d4ed5
pg_upgrade: Adjust quoting style in message to match guidelines
petere Jul 18, 2022
2c743d0
Re-add SPICleanup for ABI compatibility in stable branch
petere Jul 18, 2022
d3a1b36
Fix ruleutils issues with dropped cols in functions-returning-composite.
tglsfdc Jul 21, 2022
0ee68c9
doc: clarify that auth. names are lower case and case-sensitive
bmomjian Jul 21, 2022
71694e6
doc: use wording "restore" instead of "reload" of dumps
bmomjian Jul 21, 2022
c20fe1d
postgres_fdw: Fix bug in checking of return value of PQsendQuery().
MasaoFujii Jul 21, 2022
aa7ab62
Fix get_dirent_type() for Windows junction points.
macdice Jul 22, 2022
3368244
Doc: improve documentation about random().
tglsfdc Jul 23, 2022
04b05b3
Fix ReadRecentBuffer for local buffers.
hlinnaka Jul 25, 2022
0719949
Allow "in place" tablespaces.
alvherre Jul 27, 2022
e0c1472
Fix get_dirent_type() for symlinks on MinGW/MSYS.
macdice Jul 28, 2022
06cc38c
place allow_in_place_tablespaces in sync_guc_name
reshke Feb 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/citext/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DATA = citext--1.4.sql \
citext--1.0--1.1.sql
PGFILEDESC = "citext - case-insensitive character string data type"

REGRESS = citext
REGRESS = create_index_acl citext
REGRESS_OPTS += --init-file=$(top_srcdir)/src/test/regress/init_file

ifdef USE_PGXS
Expand Down
80 changes: 80 additions & 0 deletions contrib/citext/expected/create_index_acl.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
-- Each DefineIndex() ACL check uses either the original userid or the table
-- owner userid; see its header comment. Here, confirm that DefineIndex()
-- uses its original userid where necessary. The test works by creating
-- indexes that refer to as many sorts of objects as possible, with the table
-- owner having as few applicable privileges as possible. (The privileges.sql
-- regress_sro_user tests look for the opposite defect; they confirm that
-- DefineIndex() uses the table owner userid where necessary.)
-- Don't override tablespaces; this version lacks allow_in_place_tablespaces.
BEGIN;
SET allow_segment_DML TO true;
CREATE ROLE regress_minimal;
NOTICE: resource queue required -- using default resource queue "pg_default"
CREATE SCHEMA s;
CREATE EXTENSION citext SCHEMA s;
-- Revoke all conceivably-relevant ACLs within the extension. The system
-- doesn't check all these ACLs, but this will provide some coverage if that
-- ever changes.
REVOKE ALL ON TYPE s.citext FROM PUBLIC;
REVOKE ALL ON FUNCTION s.citext_pattern_lt FROM PUBLIC;
REVOKE ALL ON FUNCTION s.citext_pattern_le FROM PUBLIC;
REVOKE ALL ON FUNCTION s.citext_eq FROM PUBLIC;
REVOKE ALL ON FUNCTION s.citext_pattern_ge FROM PUBLIC;
REVOKE ALL ON FUNCTION s.citext_pattern_gt FROM PUBLIC;
REVOKE ALL ON FUNCTION s.citext_pattern_cmp FROM PUBLIC;
-- Functions sufficient for making an index column that has the side effect of
-- changing search_path at expression planning time.
CREATE FUNCTION public.setter() RETURNS bool VOLATILE
LANGUAGE SQL AS $$SET search_path = s; SELECT true$$;
CREATE FUNCTION s.const() RETURNS bool IMMUTABLE
LANGUAGE SQL AS $$SELECT public.setter()$$;
CREATE FUNCTION s.index_this_expr(s.citext, bool) RETURNS s.citext IMMUTABLE
LANGUAGE SQL AS $$SELECT $1$$;
REVOKE ALL ON FUNCTION public.setter FROM PUBLIC;
REVOKE ALL ON FUNCTION s.const FROM PUBLIC;
REVOKE ALL ON FUNCTION s.index_this_expr FROM PUBLIC;
-- Even for an empty table, expression planning calls s.const & public.setter.
GRANT EXECUTE ON FUNCTION public.setter TO regress_minimal;
GRANT EXECUTE ON FUNCTION s.const TO regress_minimal;
-- Function for index predicate.
CREATE FUNCTION s.index_row_if(s.citext) RETURNS bool IMMUTABLE
LANGUAGE SQL AS $$SELECT $1 IS NOT NULL$$;
REVOKE ALL ON FUNCTION s.index_row_if FROM PUBLIC;
-- Even for an empty table, CREATE INDEX checks ii_Predicate permissions.
GRANT EXECUTE ON FUNCTION s.index_row_if TO regress_minimal;
-- Non-extension, non-function objects.
CREATE COLLATION s.coll (LOCALE="C");
CREATE TABLE s.x (y s.citext) DISTRIBUTED REPLICATED;
ALTER TABLE s.x OWNER TO regress_minimal;
-- Empty-table DefineIndex()
CREATE UNIQUE INDEX u0rows ON s.x USING btree
((s.index_this_expr(y, s.const())) COLLATE s.coll s.citext_pattern_ops)
WHERE s.index_row_if(y);
ALTER TABLE s.x ADD CONSTRAINT e0rows EXCLUDE USING btree
((s.index_this_expr(y, s.const())) COLLATE s.coll WITH s.=)
WHERE (s.index_row_if(y));
-- Make the table nonempty.
INSERT INTO s.x VALUES ('foo'), ('bar');
-- If the INSERT runs the planner on index expressions, a search_path change
-- survives. As of 2022-06, the INSERT reuses a cached plan. It does so even
-- under debug_discard_caches, since each index is new-in-transaction. If
-- future work changes a cache lifecycle, this RESET may become necessary.
RESET search_path;
-- For a nonempty table, owner needs permissions throughout ii_Expressions.
GRANT EXECUTE ON FUNCTION s.index_this_expr TO regress_minimal;
CREATE UNIQUE INDEX u2rows ON s.x USING btree
((s.index_this_expr(y, s.const())) COLLATE s.coll s.citext_pattern_ops)
WHERE s.index_row_if(y);
ALTER TABLE s.x ADD CONSTRAINT e2rows EXCLUDE USING btree
((s.index_this_expr(y, s.const())) COLLATE s.coll WITH s.=)
WHERE (s.index_row_if(y));
-- Shall not find s.coll via search_path, despite the s.const->public.setter
-- call having set search_path=s during expression planning. Suppress the
-- message itself, which depends on the database encoding.
\set VERBOSITY sqlstate
ALTER TABLE s.x ADD CONSTRAINT underqualified EXCLUDE USING btree
((s.index_this_expr(y, s.const())) COLLATE coll WITH s.=)
WHERE (s.index_row_if(y));
ERROR: 42704
\set VERBOSITY default
ROLLBACK;
80 changes: 80 additions & 0 deletions contrib/citext/sql/create_index_acl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
-- Each DefineIndex() ACL check uses either the original userid or the table
-- owner userid; see its header comment. Here, confirm that DefineIndex()
-- uses its original userid where necessary. The test works by creating
-- indexes that refer to as many sorts of objects as possible, with the table
-- owner having as few applicable privileges as possible. (The privileges.sql
-- regress_sro_user tests look for the opposite defect; they confirm that
-- DefineIndex() uses the table owner userid where necessary.)

-- Don't override tablespaces; this version lacks allow_in_place_tablespaces.

BEGIN;
SET allow_segment_DML TO true;
CREATE ROLE regress_minimal;
CREATE SCHEMA s;
CREATE EXTENSION citext SCHEMA s;
-- Revoke all conceivably-relevant ACLs within the extension. The system
-- doesn't check all these ACLs, but this will provide some coverage if that
-- ever changes.
REVOKE ALL ON TYPE s.citext FROM PUBLIC;
REVOKE ALL ON FUNCTION s.citext_pattern_lt FROM PUBLIC;
REVOKE ALL ON FUNCTION s.citext_pattern_le FROM PUBLIC;
REVOKE ALL ON FUNCTION s.citext_eq FROM PUBLIC;
REVOKE ALL ON FUNCTION s.citext_pattern_ge FROM PUBLIC;
REVOKE ALL ON FUNCTION s.citext_pattern_gt FROM PUBLIC;
REVOKE ALL ON FUNCTION s.citext_pattern_cmp FROM PUBLIC;
-- Functions sufficient for making an index column that has the side effect of
-- changing search_path at expression planning time.
CREATE FUNCTION public.setter() RETURNS bool VOLATILE
LANGUAGE SQL AS $$SET search_path = s; SELECT true$$;
CREATE FUNCTION s.const() RETURNS bool IMMUTABLE
LANGUAGE SQL AS $$SELECT public.setter()$$;
CREATE FUNCTION s.index_this_expr(s.citext, bool) RETURNS s.citext IMMUTABLE
LANGUAGE SQL AS $$SELECT $1$$;
REVOKE ALL ON FUNCTION public.setter FROM PUBLIC;
REVOKE ALL ON FUNCTION s.const FROM PUBLIC;
REVOKE ALL ON FUNCTION s.index_this_expr FROM PUBLIC;
-- Even for an empty table, expression planning calls s.const & public.setter.
GRANT EXECUTE ON FUNCTION public.setter TO regress_minimal;
GRANT EXECUTE ON FUNCTION s.const TO regress_minimal;
-- Function for index predicate.
CREATE FUNCTION s.index_row_if(s.citext) RETURNS bool IMMUTABLE
LANGUAGE SQL AS $$SELECT $1 IS NOT NULL$$;
REVOKE ALL ON FUNCTION s.index_row_if FROM PUBLIC;
-- Even for an empty table, CREATE INDEX checks ii_Predicate permissions.
GRANT EXECUTE ON FUNCTION s.index_row_if TO regress_minimal;
-- Non-extension, non-function objects.
CREATE COLLATION s.coll (LOCALE="C");
CREATE TABLE s.x (y s.citext) DISTRIBUTED REPLICATED;
ALTER TABLE s.x OWNER TO regress_minimal;
-- Empty-table DefineIndex()
CREATE UNIQUE INDEX u0rows ON s.x USING btree
((s.index_this_expr(y, s.const())) COLLATE s.coll s.citext_pattern_ops)
WHERE s.index_row_if(y);
ALTER TABLE s.x ADD CONSTRAINT e0rows EXCLUDE USING btree
((s.index_this_expr(y, s.const())) COLLATE s.coll WITH s.=)
WHERE (s.index_row_if(y));
-- Make the table nonempty.
INSERT INTO s.x VALUES ('foo'), ('bar');
-- If the INSERT runs the planner on index expressions, a search_path change
-- survives. As of 2022-06, the INSERT reuses a cached plan. It does so even
-- under debug_discard_caches, since each index is new-in-transaction. If
-- future work changes a cache lifecycle, this RESET may become necessary.
RESET search_path;
-- For a nonempty table, owner needs permissions throughout ii_Expressions.
GRANT EXECUTE ON FUNCTION s.index_this_expr TO regress_minimal;
CREATE UNIQUE INDEX u2rows ON s.x USING btree
((s.index_this_expr(y, s.const())) COLLATE s.coll s.citext_pattern_ops)
WHERE s.index_row_if(y);
ALTER TABLE s.x ADD CONSTRAINT e2rows EXCLUDE USING btree
((s.index_this_expr(y, s.const())) COLLATE s.coll WITH s.=)
WHERE (s.index_row_if(y));
-- Shall not find s.coll via search_path, despite the s.const->public.setter
-- call having set search_path=s during expression planning. Suppress the
-- message itself, which depends on the database encoding.
\set VERBOSITY sqlstate
ALTER TABLE s.x ADD CONSTRAINT underqualified EXCLUDE USING btree
((s.index_this_expr(y, s.const())) COLLATE coll WITH s.=)
WHERE (s.index_row_if(y));
\set VERBOSITY default
ROLLBACK;
23 changes: 16 additions & 7 deletions contrib/pax_storage/src/test/regress/expected/create_view.out
Original file line number Diff line number Diff line change
Expand Up @@ -1551,16 +1551,25 @@ select * from tt14v;
begin;
-- this perhaps should be rejected, but it isn't:
alter table tt14t drop column f3;
-- f3 is still in the view ...
-- column f3 is still in the view, sort of ...
select pg_get_viewdef('tt14v', true);
pg_get_viewdef
--------------------------------
SELECT t.f1, +
t.f3, +
t.f4 +
FROM tt14f() t(f1, f3, f4);
pg_get_viewdef
---------------------------------
SELECT t.f1, +
t."?dropped?column?" AS f3,+
t.f4 +
FROM tt14f() t(f1, f4);
(1 row)

-- ... and you can even EXPLAIN it ...
explain (verbose, costs off) select * from tt14v;
QUERY PLAN
----------------------------------------
Function Scan on testviewschm2.tt14f t
Output: t.f1, t.f3, t.f4
Function Call: tt14f()
(3 rows)

-- but will fail at execution
select f1, f4 from tt14v;
f1 | f4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1550,16 +1550,25 @@ select * from tt14v;
begin;
-- this perhaps should be rejected, but it isn't:
alter table tt14t drop column f3;
-- f3 is still in the view ...
-- column f3 is still in the view, sort of ...
select pg_get_viewdef('tt14v', true);
pg_get_viewdef
--------------------------------
SELECT t.f1, +
t.f3, +
t.f4 +
FROM tt14f() t(f1, f3, f4);
pg_get_viewdef
---------------------------------
SELECT t.f1, +
t."?dropped?column?" AS f3,+
t.f4 +
FROM tt14f() t(f1, f4);
(1 row)

-- ... and you can even EXPLAIN it ...
explain (verbose, costs off) select * from tt14v;
QUERY PLAN
----------------------------------------
Function Scan on testviewschm2.tt14f t
Output: t.f1, t.f3, t.f4
Function Call: tt14f()
(3 rows)

-- but will fail at execution
select f1, f4 from tt14v;
f1 | f4
Expand Down
4 changes: 3 additions & 1 deletion contrib/pax_storage/src/test/regress/sql/create_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,10 @@ begin;
-- this perhaps should be rejected, but it isn't:
alter table tt14t drop column f3;

-- f3 is still in the view ...
-- column f3 is still in the view, sort of ...
select pg_get_viewdef('tt14v', true);
-- ... and you can even EXPLAIN it ...
explain (verbose, costs off) select * from tt14v;
-- but will fail at execution
select f1, f4 from tt14v;
select * from tt14v;
Expand Down
2 changes: 1 addition & 1 deletion contrib/postgres_fdw/postgres_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -7167,7 +7167,7 @@ fetch_more_data_begin(AsyncRequest *areq)
snprintf(sql, sizeof(sql), "FETCH %d FROM c%u",
fsstate->fetch_size, fsstate->cursor_number);

if (PQsendQuery(fsstate->conn, sql) < 0)
if (!PQsendQuery(fsstate->conn, sql))
pgfdw_report_error(ERROR, NULL, fsstate->conn, false, fsstate->query);

/* Remember that the request is in process */
Expand Down
4 changes: 3 additions & 1 deletion doc/src/sgml/client-auth.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,9 @@ hostnogssenc <replaceable>database</replaceable> <replaceable>user</replaceabl
<para>
Specifies the authentication method to use when a connection matches
this record. The possible choices are summarized here; details
are in <xref linkend="auth-methods"/>.
are in <xref linkend="auth-methods"/>. All the options
are lower case and treated case sensitively, so even acronyms like
<literal>ldap</literal> must be specified as lower case.

<variablelist>
<varlistentry>
Expand Down
19 changes: 19 additions & 0 deletions doc/src/sgml/config.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -10458,6 +10458,25 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</para>

<variablelist>
<varlistentry id="guc-allow-in-place-tablespaces" xreflabel="allow_in_place_tablespaces">
<term><varname>allow_in_place_tablespaces</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>allow_in_place_tablespaces</varname> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
Allows tablespaces to be created as directories inside
<filename>pg_tblspc</filename>, when an empty location string
is provided to the <command>CREATE TABLESPACE</command> command. This
is intended to allow testing replication scenarios where primary and
standby servers are running on the same machine. Such directories
are likely to confuse backup tools that expect to find only symbolic
links in that location. Only superusers can change this setting.
</para>
</listitem>
</varlistentry>

<varlistentry id="guc-allow-system-table-mods" xreflabel="allow_system_table_mods">
<term><varname>allow_system_table_mods</varname> (<type>boolean</type>)
<indexterm>
Expand Down
10 changes: 5 additions & 5 deletions doc/src/sgml/ddl.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ CREATE TABLE products (
tests, it cannot guarantee that the database will not reach a state
in which the constraint condition is false (due to subsequent changes
of the other row(s) involved). This would cause a database dump and
reload to fail. The reload could fail even when the complete
restore to fail. The restore could fail even when the complete
database state is consistent with the constraint, due to rows not
being loaded in an order that will satisfy the constraint. If
possible, use <literal>UNIQUE</literal>, <literal>EXCLUDE</literal>,
Expand All @@ -569,10 +569,10 @@ CREATE TABLE products (
If what you desire is a one-time check against other rows at row
insertion, rather than a continuously-maintained consistency
guarantee, a custom <link linkend="triggers">trigger</link> can be used
to implement that. (This approach avoids the dump/reload problem because
to implement that. (This approach avoids the dump/restore problem because
<application>pg_dump</application> does not reinstall triggers until after
reloading data, so that the check will not be enforced during a
dump/reload.)
restoring data, so that the check will not be enforced during a
dump/restore.)
</para>
</note>

Expand All @@ -594,7 +594,7 @@ CREATE TABLE products (
function. <productname>PostgreSQL</productname> does not disallow
that, but it will not notice if there are rows in the table that now
violate the <literal>CHECK</literal> constraint. That would cause a
subsequent database dump and reload to fail.
subsequent database dump and restore to fail.
The recommended way to handle such a change is to drop the constraint
(using <command>ALTER TABLE</command>), adjust the function definition,
and re-add the constraint, thereby rechecking it against all table rows.
Expand Down
39 changes: 38 additions & 1 deletion doc/src/sgml/ecpg.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,8 @@ EXEC SQL SELECT b INTO :val :val_ind FROM test1;
</programlisting>
The indicator variable <varname>val_ind</varname> will be zero if
the value was not null, and it will be negative if the value was
null.
null. (See <xref linkend="ecpg-oracle-compat"/> to enable
Oracle-specific behavior.)
</para>

<para>
Expand Down Expand Up @@ -9801,6 +9802,42 @@ risnull(CINTTYPE, (char *) &i);
</sect2>
</sect1>

<sect1 id="ecpg-oracle-compat">
<title><productname>Oracle</productname> Compatibility Mode</title>
<para>
<command>ecpg</command> can be run in a so-called <firstterm>Oracle
compatibility mode</firstterm>. If this mode is active, it tries to
behave as if it were Oracle <productname>Pro*C</productname>.
</para>

<para>
Specifically, this mode changes <command>ecpg</command> in three ways:

<itemizedlist>
<listitem>
<para>
Pad character arrays receiving character string types with
trailing spaces to the specified length
</para>
</listitem>

<listitem>
<para>
Zero byte terminate these character arrays, and set the indicator
variable if truncation occurs
</para>
</listitem>

<listitem>
<para>
Set the null indicator to <literal>-1</literal> when character
arrays receive empty character string types
</para>
</listitem>
</itemizedlist>
</para>
</sect1>

<sect1 id="ecpg-develop">
<title>Internals</title>

Expand Down
2 changes: 1 addition & 1 deletion doc/src/sgml/extend.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ SET LOCAL search_path TO @extschema@, pg_temp;
<application>pg_dump</application>. But that behavior is undesirable for a
configuration table; any data changes made by the user need to be
included in dumps, or the extension will behave differently after a dump
and reload.
and restore.
</para>

<indexterm>
Expand Down
Loading
Loading