pgsql: Fix MSVC recipe for ecpg regression tests, redux.

2024-04-18 Thread Tom Lane
Fix MSVC recipe for ecpg regression tests, redux.

Forgot to inject -DCMDLINESYM=123 ...

Per buildfarm.

Discussion: 
https://postgr.es/m/4cc4dc47-ca2b-4129-8784-db69b5f82...@dunslane.net

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/de84608e263920a77f2c1b2a86c90642c8e35fe9

Modified Files
--
src/tools/msvc/ecpg_regression.proj | 3 +++
1 file changed, 3 insertions(+)



pgsql: Fix MSVC recipe for ecpg regression tests, redux.

2024-04-18 Thread Tom Lane
Fix MSVC recipe for ecpg regression tests, redux.

Forgot to inject -DCMDLINESYM=123 ...

Per buildfarm.

Discussion: 
https://postgr.es/m/4cc4dc47-ca2b-4129-8784-db69b5f82...@dunslane.net

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/f7e8917481b5d84714a1399ede0086a6520bc577

Modified Files
--
src/tools/msvc/ecpg_regression.proj | 3 +++
1 file changed, 3 insertions(+)



pgsql: Fix MSVC recipe for ecpg regression tests, redux.

2024-04-18 Thread Tom Lane
Fix MSVC recipe for ecpg regression tests, redux.

Forgot to inject -DCMDLINESYM=123 ...

Per buildfarm.

Discussion: 
https://postgr.es/m/4cc4dc47-ca2b-4129-8784-db69b5f82...@dunslane.net

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/cd26f08e4770fb9d029e51d36dd0f4c3f09c5514

Modified Files
--
src/tools/msvc/ecpg_regression.proj | 3 +++
1 file changed, 3 insertions(+)



pgsql: Fix MSVC recipe for ecpg regression tests, redux.

2024-04-18 Thread Tom Lane
Fix MSVC recipe for ecpg regression tests, redux.

Forgot to inject -DCMDLINESYM=123 ...

Per buildfarm.

Discussion: 
https://postgr.es/m/4cc4dc47-ca2b-4129-8784-db69b5f82...@dunslane.net

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/c6bfeab42ba203d0565a22612be8717c0b911e7e

Modified Files
--
src/tools/msvc/ecpg_regression.proj | 3 +++
1 file changed, 3 insertions(+)



pgsql: Fix MSVC recipe for ecpg regression tests, redux.

2024-04-18 Thread Tom Lane
Fix MSVC recipe for ecpg regression tests, redux.

Forgot to inject -DCMDLINESYM=123 ...

Per buildfarm.

Discussion: 
https://postgr.es/m/4cc4dc47-ca2b-4129-8784-db69b5f82...@dunslane.net

Branch
--
REL_16_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/dd3fddc8519a7d18cc02045d8996ead09f63be66

Modified Files
--
src/tools/msvc/ecpg_regression.proj | 3 +++
1 file changed, 3 insertions(+)



pgsql: Fix MSVC recipe for ecpg regression tests.

2024-04-18 Thread Tom Lane
Fix MSVC recipe for ecpg regression tests.

While back-patching commit 6f0cef935, I forgot that the MSVC
build scripts would also need adjustment in the back branches.
This is a blind attempt at a fix, but it's basically copying
nearby code so I think it will work.

Per buildfarm (via Andrew Dunstan)

Discussion: 
https://postgr.es/m/4cc4dc47-ca2b-4129-8784-db69b5f82...@dunslane.net

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/1e7b1b026d8270d5c70ecc60e748c5d99727

Modified Files
--
src/tools/msvc/ecpg_regression.proj | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



pgsql: Fix MSVC recipe for ecpg regression tests.

2024-04-18 Thread Tom Lane
Fix MSVC recipe for ecpg regression tests.

While back-patching commit 6f0cef935, I forgot that the MSVC
build scripts would also need adjustment in the back branches.
This is a blind attempt at a fix, but it's basically copying
nearby code so I think it will work.

Per buildfarm (via Andrew Dunstan)

Discussion: 
https://postgr.es/m/4cc4dc47-ca2b-4129-8784-db69b5f82...@dunslane.net

Branch
--
REL_16_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/0018f0af5a51f9af5d7d3f1c17a38620f9ec8a18

Modified Files
--
src/tools/msvc/ecpg_regression.proj | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



pgsql: Fix MSVC recipe for ecpg regression tests.

2024-04-18 Thread Tom Lane
Fix MSVC recipe for ecpg regression tests.

While back-patching commit 6f0cef935, I forgot that the MSVC
build scripts would also need adjustment in the back branches.
This is a blind attempt at a fix, but it's basically copying
nearby code so I think it will work.

Per buildfarm (via Andrew Dunstan)

Discussion: 
https://postgr.es/m/4cc4dc47-ca2b-4129-8784-db69b5f82...@dunslane.net

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/df66319f776d01a83b1fb1aab8b74578f9c64421

Modified Files
--
src/tools/msvc/ecpg_regression.proj | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



pgsql: Fix MSVC recipe for ecpg regression tests.

2024-04-18 Thread Tom Lane
Fix MSVC recipe for ecpg regression tests.

While back-patching commit 6f0cef935, I forgot that the MSVC
build scripts would also need adjustment in the back branches.
This is a blind attempt at a fix, but it's basically copying
nearby code so I think it will work.

Per buildfarm (via Andrew Dunstan)

Discussion: 
https://postgr.es/m/4cc4dc47-ca2b-4129-8784-db69b5f82...@dunslane.net

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/481597fc6cb8235cf62ceb4252a9e5835b3283ac

Modified Files
--
src/tools/msvc/ecpg_regression.proj | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



pgsql: Fix MSVC recipe for ecpg regression tests.

2024-04-18 Thread Tom Lane
Fix MSVC recipe for ecpg regression tests.

While back-patching commit 6f0cef935, I forgot that the MSVC
build scripts would also need adjustment in the back branches.
This is a blind attempt at a fix, but it's basically copying
nearby code so I think it will work.

Per buildfarm (via Andrew Dunstan)

Discussion: 
https://postgr.es/m/4cc4dc47-ca2b-4129-8784-db69b5f82...@dunslane.net

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/61dd815e0bb5f4b591343e2382486fa5e4e46539

Modified Files
--
src/tools/msvc/ecpg_regression.proj | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



Re: pgsql: Fix assorted bugs in ecpg's macro mechanism.

2024-04-18 Thread Tom Lane
Andrew Dunstan  writes:
> On 2024-04-16 Tu 12:31, Tom Lane wrote:
>> Fix assorted bugs in ecpg's macro mechanism.

> Buildfarm animals running the old MSVC build system don't like this.

Oh, duh, I'd already forgotten about that...

> It looks to me like we'll need an adjustment in 
> src/tools/msvc/ecpg_regression.proj to replicate the special rules 
> surrounding define.c and define_prelim.c. Not sure who has the requisite 
> knowledge to do that - I don't.

I will see if I can fix it.

regards, tom lane




Re: pgsql: Fix assorted bugs in ecpg's macro mechanism.

2024-04-18 Thread Andrew Dunstan



On 2024-04-16 Tu 12:31, Tom Lane wrote:

Fix assorted bugs in ecpg's macro mechanism.



Buildfarm animals running the old MSVC build system don't like this.

It looks to me like we'll need an adjustment in 
src/tools/msvc/ecpg_regression.proj to replicate the special rules 
surrounding define.c and define_prelim.c. Not sure who has the requisite 
knowledge to do that - I don't.



cheers


andrew

--

Andrew Dunstan
EDB: https://www.enterprisedb.com





pgsql: Doc: Update link to the mentioned subsection

2024-04-18 Thread Daniel Gustafsson
Doc: Update link to the mentioned subsection

This updates the link from pg_createsubscriber to initial data sync
to actually link to the subsection in question as opposed to the
main logical replication section.

Author: Pavel Luzanov 
Discussion: 
https://postgr.es/m/a4af555a-ac60-4416-877d-0440d29b8...@postgrespro.ru

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/84db9a0eb10dd1dbee6db509c0e427fa237177dc

Modified Files
--
doc/src/sgml/ref/pg_createsubscriber.sgml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



pgsql: Fix typos and duplicate words

2024-04-18 Thread Daniel Gustafsson
Fix typos and duplicate words

This fixes various typos, duplicated words, and tiny bits of whitespace
mainly in code comments but also in docs.

Author: Daniel Gustafsson 
Author: Heikki Linnakangas 
Author: Alexander Lakhin 
Author: David Rowley 
Author: Nazir Bilal Yavuz 
Discussion: https://postgr.es/m/3f577953-a29e-4722-98ad-2da9eff2c...@yesql.se

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/950d4a2cb1d5f427dbccf70dbad510479cc4d8e6

Modified Files
--
contrib/amcheck/expected/check_btree.out|  2 +-
contrib/amcheck/sql/check_btree.sql |  2 +-
contrib/amcheck/verify_nbtree.c |  2 +-
doc/src/sgml/maintenance.sgml   |  2 +-
doc/src/sgml/meson.build|  2 +-
src/backend/access/gin/ginbtree.c   |  2 +-
src/backend/access/heap/pruneheap.c |  6 +++---
src/backend/access/nbtree/nbtutils.c|  4 ++--
src/backend/access/rmgrdesc/xactdesc.c  |  2 +-
src/backend/catalog/pg_constraint.c |  2 +-
src/backend/catalog/system_functions.sql|  2 +-
src/backend/commands/amcmds.c   |  2 +-
src/backend/commands/copyfrom.c |  2 +-
src/backend/commands/dbcommands.c   |  4 ++--
src/backend/commands/tablecmds.c|  2 +-
src/backend/commands/vacuumparallel.c   |  2 +-
src/backend/executor/execExpr.c |  2 +-
src/backend/optimizer/path/equivclass.c |  2 +-
src/backend/optimizer/path/pathkeys.c   |  2 +-
src/backend/optimizer/prep/prepunion.c  |  3 ++-
src/backend/parser/parse_jsontable.c|  2 +-
src/backend/parser/parse_utilcmd.c  |  4 ++--
src/backend/partitioning/partbounds.c   |  6 +++---
src/backend/partitioning/partprune.c|  2 +-
src/backend/postmaster/launch_backend.c |  2 +-
src/backend/postmaster/walsummarizer.c  |  2 +-
src/backend/replication/logical/slotsync.c  |  2 +-
src/backend/replication/walsender.c |  2 +-
src/backend/statistics/dependencies.c   |  4 ++--
src/backend/storage/aio/read_stream.c   |  6 +++---
src/backend/storage/buffer/bufmgr.c |  2 +-
src/backend/storage/lmgr/lock.c |  2 +-
src/backend/storage/lmgr/proc.c |  2 +-
src/backend/utils/adt/jsonpath_exec.c   |  4 ++--
src/backend/utils/adt/multirangetypes.c |  2 +-
src/backend/utils/adt/selfuncs.c|  2 +-
src/backend/utils/mmgr/aset.c   |  4 ++--
src/backend/utils/mmgr/bump.c   |  4 ++--
src/backend/utils/mmgr/generation.c |  4 ++--
src/bin/pg_basebackup/bbstreamer_tar.c  |  2 +-
src/bin/pg_combinebackup/pg_combinebackup.c |  2 +-
src/bin/pg_combinebackup/reconstruct.c  |  2 +-
src/bin/pg_upgrade/t/004_subscription.pl|  2 +-
src/common/unicode_category.c   |  2 +-
src/include/access/heapam_xlog.h| 10 +-
src/include/common/hashfn_unstable.h|  2 +-
src/include/lib/radixtree.h |  6 +++---
src/include/nodes/pathnodes.h   |  2 +-
src/include/nodes/primnodes.h   |  2 +-
src/include/storage/proc.h  |  2 +-
src/interfaces/libpq/fe-cancel.c|  2 +-
src/interfaces/libpq/fe-secure-openssl.c|  2 +-
src/test/isolation/expected/temp-schema-cleanup.out |  4 ++--
src/test/isolation/specs/temp-schema-cleanup.spec   |  2 +-
src/test/modules/test_resowner/test_resowner_many.c |  2 +-
src/test/regress/expected/aggregates.out|  2 +-
src/test/regress/expected/copy.out  |  4 ++--
src/test/regress/expected/foreign_key.out   |  2 +-
src/test/regress/expected/publication.out   |  4 ++--
src/test/regress/expected/tsdicts.out   |  2 +-
src/test/regress/sql/aggregates.sql |  2 +-
src/test/regress/sql/copy.sql   |  4 ++--
src/test/regress/sql/foreign_key.sql|  2 +-
src/test/regress/sql/publication.sql|  4 ++--
src/test/regress/sql/tsdicts.sql|  2 +-
src/test/subscription/t/004_sync.pl |  2 +-
src/test/subscription/t/026_stats.pl|  2 +-
67 files changed, 93 insertions(+), 92 deletions(-)



pgsql: Remove spurious "the".

2024-04-18 Thread Robert Haas
Remove spurious "the".

Spotted by Martin Marqués.

Discussion: 
http://postgr.es/m/cabeg9lvqmtskrokhca_mkju1duarw4v+smejkurygjpvbzf...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/fbed6ebe41beb72d9b7978a414ed4e8515ed1b19

Modified Files
--
doc/src/sgml/ref/pg_combinebackup.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Don't try to fix eliminated nbtree array scan keys.

2024-04-18 Thread Peter Geoghegan
Don't try to fix eliminated nbtree array scan keys.

Preprocessing for nbtree index scans allowed array "input" scan keys
already marked eliminated during array-specific preprocessing to be
"fixed up" during preprocessing proper.  This allowed eliminated scan
keys on DESC index columns to spurious have their strategy commuted,
causing assertion failures.

To fix, teach _bt_fix_scankey_strategy to ignore these scan keys.  This
brings it in line with its only caller, _bt_preprocess_keys.

Oversight in commit 5bf748b8, which enhanced nbtree ScalarArrayOp
execution.

Reported-By: Donghang Lin 
Discussion: 
https://postgr.es/m/CAA=D8a2sHK6CAzZ=0CeafC-Y-MFXbYxnRSHvZTi=+jhu6ka...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/f22e17f76cf569a797c45268081feadc8ebd68c7

Modified Files
--
src/backend/access/nbtree/nbtutils.c | 7 +++
1 file changed, 7 insertions(+)



pgsql: Restrict where INCREMENTAL.${NAME} files are recognized.

2024-04-18 Thread Robert Haas
Restrict where INCREMENTAL.${NAME} files are recognized.

Previously, they were recognized anywhere in an incremental backup
directory; now, we restrict this to places where they are expected to
appear. That means this code will need updating if we ever do
incremental backups of files in other places (e.g. SLRU files), but
it lets you create a file called INCREMENTAL.config (or something like
that) at the top level of the data directory and still have things
work.

Patch by me, per request from David Steele, who also reviewed.

Discussion: 
http://postgr.es/m/5a7817da-6349-4653-8056-470300b6e...@pgmasters.net

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/9e72f6bfae1707fca1a297db433f6145d582a1c2

Modified Files
--
src/bin/pg_combinebackup/pg_combinebackup.c | 47 +
src/bin/pg_combinebackup/t/005_integrity.pl |  9 ++
2 files changed, 43 insertions(+), 13 deletions(-)



pgsql: Don't try to assign smart names to constraints

2024-04-18 Thread Alvaro Herrera
Don't try to assign smart names to constraints

This part of my previous commit seems to have broken pg_upgrade on
crake, at least from 9.2.  I'll see if there's a better fix, but in the
meantime this should suffice to keep the buildfarm green.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/d72d32f52d26c9588256de90b9bc54fe312cee60

Modified Files
--
src/bin/pg_dump/pg_dump.c | 16 +++-
1 file changed, 3 insertions(+), 13 deletions(-)



Re: pgsql: Fix restore of not-null constraints with inheritance

2024-04-18 Thread Alvaro Herrera
On 2024-Apr-18, Alvaro Herrera wrote:

> Lastly, make two changes to pg_dump: 1) do not try to drop a not-null
> constraint that's marked as inherited; this allows a dump to restore
> with no errors if a table with a PK inherits from another which also has
> a PK; 2) avoid giving inherited constraints throwaway names, for the
> rare cases where such a constraint survives after the restore.

Hmm, this last bit broke pg_upgrade on crake.  I'll revert this part,
meanwhile I'll be installing 9.2 to see if it can be fixed in a better way.

-- 
Álvaro Herrera PostgreSQL Developer  —  https://www.EnterpriseDB.com/




pgsql: docs: Mention that pg_combinebackup does not verify backups.

2024-04-18 Thread Robert Haas
docs: Mention that pg_combinebackup does not verify backups.

We don't want users to think that pg_combinebackup is trying to check
the validity of individual backups, because it isn't. Adjust the wording
about sanity checks to make it clear that verification of individual
backups is the job of pg_verifybackup, and that the checks performed
by pg_combinebackup are around the relationships between the backups.

Per discussion with David Steele.

Discussion: 
http://postgr.es/m/e6f930c3-590c-47b9-b094-217bb2a3e...@pgmasters.net

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/2e2d4604d94318a304d350aee478bda91a521339

Modified Files
--
doc/src/sgml/ref/pg_combinebackup.sgml | 14 +-
1 file changed, 9 insertions(+), 5 deletions(-)



pgsql: Fix restore of not-null constraints with inheritance

2024-04-18 Thread Alvaro Herrera
Fix restore of not-null constraints with inheritance

In tables with primary keys, pg_dump creates tables with primary keys by
initially dumping them with throw-away not-null constraints (marked "no
inherit" so that they don't create problems elsewhere), to later drop
them once the primary key is restored.  Because of a unrelated
consideration, on tables with children we add not-null constraints to
all columns of the primary key when it is created.

If both a table and its child have primary keys, and pg_dump happens to
emit the child table first (and its throw-away not-null) and later its
parent table, the creation of the parent's PK will fail because the
throw-away not-null constraint collides with the permanent not-null
constraint that the PK wants to add, so the dump fails to restore.

We can work around this problem by letting the primary key "take over"
the child's not-null.  This requires no changes to pg_dump, just two
changes to ALTER TABLE: first, the ability to convert a no-inherit
not-null constraint into a regular inheritable one (including recursing
down to children, if there are any); second, the ability to "drop" a
constraint that is defined both directly in the table and inherited from
a parent (which simply means to mark it as no longer having a local
definition).

Secondarily, change ATPrepAddPrimaryKey() to acquire locks all the way
down the inheritance hierarchy, in case we need to recurse when
propagating constraints.

These two changes allow pg_dump to reproduce more cases involving
inheritance from versions 16 and older.

Lastly, make two changes to pg_dump: 1) do not try to drop a not-null
constraint that's marked as inherited; this allows a dump to restore
with no errors if a table with a PK inherits from another which also has
a PK; 2) avoid giving inherited constraints throwaway names, for the
rare cases where such a constraint survives after the restore.

Reported-by: Andrew Bille 
Reported-by: Justin Pryzby 
Discussion: 
https://postgr.es/m/cajnzarwkfru76_yi3dqvf_wl-mpvt54zmwaxfwjcexdhb76...@mail.gmail.com
Discussion: https://postgr.es/m/Zh0aAH7tbZb-9HbC@pryzbyj2023

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/d9f686a72ee91f6773e5d2bc52994db8d7157a8e

Modified Files
--
src/backend/catalog/heap.c| 36 +++--
src/backend/catalog/pg_constraint.c   | 43 +---
src/backend/commands/tablecmds.c  | 65 +++
src/bin/pg_dump/pg_dump.c | 26 +++--
src/include/catalog/pg_constraint.h   |  2 +-
src/test/regress/expected/constraints.out | 56 ++
src/test/regress/sql/constraints.sql  | 22 +++
7 files changed, 221 insertions(+), 29 deletions(-)



pgsql: Update src/tools/pginclude/README to match recent changes to cpl

2024-04-18 Thread Peter Eisentraut
Update src/tools/pginclude/README to match recent changes to cpluspluscheck

Commit 7b8e2ae2f has turned cpluspluscheck from separate script into a
--cplusplus option for headerscheck.  Update README correspondingly.

Author: Anton Voloshin 
Discussion: 
https://www.postgresql.org/message-id/02e69fa9-885d-4f41-9057-15a1d212e...@postgrespro.ru

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/e0d51e3bf45436bdf84d096916daea2af2c7ba6e

Modified Files
--
src/tools/pginclude/README | 26 ++
1 file changed, 14 insertions(+), 12 deletions(-)



pgsql: Fix object name clash in recently introduced test

2024-04-18 Thread Amit Langote
Fix object name clash in recently introduced test

c0fc0751862 wasn't careful about naming the DOMAIN used in some new
tests in sqljson_queryfunc.sql so as not to clash with the name of a
DOMAIN used in the nearby sqljson_jsontable.sql.  Fix by using a
different name for the newly added DOMAIN in sqljson_queryfuncs.sql.

Per buildfarm members canebrake and urutu.

Discussion: 
https://postgr.es/m/CA+HiwqEjkbDxqqD3VJamc6R9+B102H7=sfyyom7gkrxzjo3...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/2c7cea5a8e741b7f7f9f12700d59b49b376301a1

Modified Files
--
src/test/regress/expected/sqljson_queryfuncs.out | 18 +-
src/test/regress/sql/sqljson_queryfuncs.sql  | 14 +++---
2 files changed, 16 insertions(+), 16 deletions(-)



Re: pgsql: SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY

2024-04-18 Thread Amit Langote
On Thu, Apr 18, 2024 at 3:51 PM Amit Langote  wrote:
> SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY
>
> SQL/JSON query functions allow specifying an expression to return
> when either of ON ERROR or ON EMPTY condition occurs when evaluating
> the JSON path expression.  The parser (transformJsonBehavior()) checks
> that the specified expression is one of the supported expressions, but
> there are two issues with how the check is done that are fixed in this
> commit:
>
> * No check for some expressions related to coercion, such as
>   CoerceViaIO, that may appear in the transformed user-specified
>   expressions that include cast(s)
>
> * An unsupported expression may be masked by a coercion-related
>   expression, which must be flagged by checking the latter's
>   argument expression recursively
>
> Author: Jian He 
> Author: Amit Langote 
> Reported-by: Jian He 
> Discussion: 
> https://postgr.es/m/cacjufxeqhqsfrg_p7emyo5zak3d767ifdl8vz_4%3dzbhpotr...@mail.gmail.com
> Discussion: 
> https://postgr.es/m/cacjufxgoerh1qjknm1noh-kz5fqu4p7qfezsevt2tn_4slx...@mail.gmail.com
>
> Branch
> --
> master
>
> Details
> ---
> https://git.postgresql.org/pg/commitdiff/c0fc0751862d4e9b7ca9d51f2cd79344690ec873
>
> Modified Files
> --
> src/backend/parser/parse_expr.c  | 37 ++-
> src/test/regress/expected/sqljson_jsontable.out  | 32 +
> src/test/regress/expected/sqljson_queryfuncs.out | 57 
> src/test/regress/sql/sqljson_jsontable.sql   | 16 +++
> src/test/regress/sql/sqljson_queryfuncs.sql  | 27 +++
> 5 files changed, 167 insertions(+), 2 deletions(-)

Noticed failures on canebrake and urutu that seem to have to do with
using the same DOMAIN name in nearby test files causing a clash.

Will push a fix shortly.

-- 
Thanks, Amit Langote




pgsql: SQL/JSON: Improve some error messages

2024-04-18 Thread Amit Langote
SQL/JSON: Improve some error messages

This improves some error messages emitted by SQL/JSON query functions
by mentioning column name when available, such as when they are
invoked as part of evaluating JSON_TABLE() columns.  To do so, a new
field column_name is added to both JsonFuncExpr and JsonExpr that is
only populated when creating those nodes for transformed JSON_TABLE()
columns.

While at it, relevant error messages are reworded for clarity.

Reported-by: Jian He 
Suggested-by: Jian He 
Discussion: 
https://postgr.es/m/cacjufxg_e0qlcgaelrr2znz7axpegcnkaore3fhtfcqlsh4...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/b4fad46b6bc8a9bf46ff689bcb1bd4edf8f267af

Modified Files
--
src/backend/executor/execExprInterp.c| 43 --
src/backend/parser/parse_expr.c  |  1 +
src/backend/parser/parse_jsontable.c | 10 +++---
src/backend/utils/adt/jsonpath_exec.c| 45 +---
src/include/nodes/parsenodes.h   |  2 ++
src/include/nodes/primnodes.h|  3 ++
src/include/utils/jsonpath.h |  6 ++--
src/test/regress/expected/sqljson_jsontable.out  | 10 --
src/test/regress/expected/sqljson_queryfuncs.out | 30 
src/test/regress/sql/sqljson_jsontable.sql   |  3 ++
10 files changed, 96 insertions(+), 57 deletions(-)



pgsql: SQL/JSON: Miscellaneous fixes and improvements

2024-04-18 Thread Amit Langote
SQL/JSON: Miscellaneous fixes and improvements

This addresses some post-commit review comments for commits 6185c973,
de3600452, and 9425c596a0, with the following changes:

* Fix JSON_TABLE() syntax documentation to use the term
  "path_expression" for JSON path expressions instead of
  "json_path_specification" to be consistent with the other SQL/JSON
  functions.

* Fix a typo in the example code in JSON_TABLE() documentation.

* Rewrite some newly added comments in jsonpath.h.

* In JsonPathQuery(), add missing cast to int before printing an enum
  value.

Reported-by: Jian He 
Discussion: 
https://postgr.es/m/cacjufxg_e0qlcgaelrr2znz7axpegcnkaore3fhtfcqlsh4...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/ef744ebb7340d42361ebd88d068b27b17e69de18

Modified Files
--
doc/src/sgml/func.sgml| 9 +
src/backend/utils/adt/jsonpath_exec.c | 2 +-
src/include/utils/jsonpath.h  | 8 +++-
3 files changed, 9 insertions(+), 10 deletions(-)



pgsql: SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY

2024-04-18 Thread Amit Langote
SQL/JSON: Fix issues with DEFAULT .. ON ERROR / EMPTY

SQL/JSON query functions allow specifying an expression to return
when either of ON ERROR or ON EMPTY condition occurs when evaluating
the JSON path expression.  The parser (transformJsonBehavior()) checks
that the specified expression is one of the supported expressions, but
there are two issues with how the check is done that are fixed in this
commit:

* No check for some expressions related to coercion, such as
  CoerceViaIO, that may appear in the transformed user-specified
  expressions that include cast(s)

* An unsupported expression may be masked by a coercion-related
  expression, which must be flagged by checking the latter's
  argument expression recursively

Author: Jian He 
Author: Amit Langote 
Reported-by: Jian He 
Discussion: 
https://postgr.es/m/cacjufxeqhqsfrg_p7emyo5zak3d767ifdl8vz_4%3dzbhpotr...@mail.gmail.com
Discussion: 
https://postgr.es/m/cacjufxgoerh1qjknm1noh-kz5fqu4p7qfezsevt2tn_4slx...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/c0fc0751862d4e9b7ca9d51f2cd79344690ec873

Modified Files
--
src/backend/parser/parse_expr.c  | 37 ++-
src/test/regress/expected/sqljson_jsontable.out  | 32 +
src/test/regress/expected/sqljson_queryfuncs.out | 57 
src/test/regress/sql/sqljson_jsontable.sql   | 16 +++
src/test/regress/sql/sqljson_queryfuncs.sql  | 27 +++
5 files changed, 167 insertions(+), 2 deletions(-)