pgsql: Fix test case from a8ccf4e93

2024-11-25 Thread Richard Guo
Fix test case from a8ccf4e93 Commit a8ccf4e93 uses the same table name "distinct_tbl" in both select_distinct.sql and select_distinct_on.sql, which could cause conflicts when these two test scripts are run in parallel. Fix by renaming the table in select_distinct_on.sql to "distinct_on_tbl". Per

pgsql: pg_amcheck: Use CppAsString2() for relkind and relpersistence in

2024-11-25 Thread Michael Paquier
pg_amcheck: Use CppAsString2() for relkind and relpersistence in queries This utility has been using hardcoded values for relkind and relpersistence in its queries generated. These queries are switched to use CppAsString2() instead, with the values fetched directly from the header of pg_class. T

pgsql: Remove dead code in get_param_path_clause_serials()

2024-11-25 Thread Richard Guo
Remove dead code in get_param_path_clause_serials() The function get_param_path_clause_serials() is used to get the set of pushed-down clauses enforced within a parameterized Path. Since we don't currently support parameterized MergeAppend paths, and it doesn't look like that is going to change a

pgsql: Reordering DISTINCT keys to match input path's pathkeys

2024-11-25 Thread Richard Guo
Reordering DISTINCT keys to match input path's pathkeys The ordering of DISTINCT items is semantically insignificant, so we can reorder them as needed. In fact, in the parser, we absorb the sorting semantics of the sortClause as much as possible into the distinctClause, ensuring that one clause i

pgsql: Fix NULLIF()'s handling of read-write expanded objects.

2024-11-25 Thread Tom Lane
Fix NULLIF()'s handling of read-write expanded objects. If passed a read-write expanded object pointer, the EEOP_NULLIF code would hand that same pointer to the equality function and then (unless equality was reported) also return the same pointer as its value. This is no good, because a function

pgsql: Fix NULLIF()'s handling of read-write expanded objects.

2024-11-25 Thread Tom Lane
Fix NULLIF()'s handling of read-write expanded objects. If passed a read-write expanded object pointer, the EEOP_NULLIF code would hand that same pointer to the equality function and then (unless equality was reported) also return the same pointer as its value. This is no good, because a function

pgsql: Fix NULLIF()'s handling of read-write expanded objects.

2024-11-25 Thread Tom Lane
Fix NULLIF()'s handling of read-write expanded objects. If passed a read-write expanded object pointer, the EEOP_NULLIF code would hand that same pointer to the equality function and then (unless equality was reported) also return the same pointer as its value. This is no good, because a function

pgsql: Fix NULLIF()'s handling of read-write expanded objects.

2024-11-25 Thread Tom Lane
Fix NULLIF()'s handling of read-write expanded objects. If passed a read-write expanded object pointer, the EEOP_NULLIF code would hand that same pointer to the equality function and then (unless equality was reported) also return the same pointer as its value. This is no good, because a function

pgsql: Fix NULLIF()'s handling of read-write expanded objects.

2024-11-25 Thread Tom Lane
Fix NULLIF()'s handling of read-write expanded objects. If passed a read-write expanded object pointer, the EEOP_NULLIF code would hand that same pointer to the equality function and then (unless equality was reported) also return the same pointer as its value. This is no good, because a function

pgsql: Fix NULLIF()'s handling of read-write expanded objects.

2024-11-25 Thread Tom Lane
Fix NULLIF()'s handling of read-write expanded objects. If passed a read-write expanded object pointer, the EEOP_NULLIF code would hand that same pointer to the equality function and then (unless equality was reported) also return the same pointer as its value. This is no good, because a function

pgsql: Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABL

2024-11-25 Thread Noah Misch
Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABLESPACE. This WARNING appeared because SearchSysCacheLocked1() read cc_relisshared before catcache initialization, when the field is false unconditionally. On the basis of reading false there, it constructed a locktag as though pg_tab

pgsql: Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABL

2024-11-25 Thread Noah Misch
Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABLESPACE. This WARNING appeared because SearchSysCacheLocked1() read cc_relisshared before catcache initialization, when the field is false unconditionally. On the basis of reading false there, it constructed a locktag as though pg_tab

pgsql: Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABL

2024-11-25 Thread Noah Misch
Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABLESPACE. This WARNING appeared because SearchSysCacheLocked1() read cc_relisshared before catcache initialization, when the field is false unconditionally. On the basis of reading false there, it constructed a locktag as though pg_tab

pgsql: Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABL

2024-11-25 Thread Noah Misch
Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABLESPACE. This WARNING appeared because SearchSysCacheLocked1() read cc_relisshared before catcache initialization, when the field is false unconditionally. On the basis of reading false there, it constructed a locktag as though pg_tab

pgsql: Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABL

2024-11-25 Thread Noah Misch
Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABLESPACE. This WARNING appeared because SearchSysCacheLocked1() read cc_relisshared before catcache initialization, when the field is false unconditionally. On the basis of reading false there, it constructed a locktag as though pg_tab

pgsql: Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABL

2024-11-25 Thread Noah Misch
Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABLESPACE. This WARNING appeared because SearchSysCacheLocked1() read cc_relisshared before catcache initialization, when the field is false unconditionally. On the basis of reading false there, it constructed a locktag as though pg_tab

pgsql: pg_dump: Add dumpSchema and dumpData derivative flags.

2024-11-25 Thread Nathan Bossart
pg_dump: Add dumpSchema and dumpData derivative flags. Various parts of pg_dump consult the --schema-only and --data-only options to determine whether to run a section of code. While this is simple enough for two mutually-exclusive options, it will become progressively more complicated as more op

pgsql: Clean up reference in meson.build.

2024-11-25 Thread Thomas Munro
Clean up reference in meson.build. Commit bc5a4dfc accidentally left a check for in meson.build's header_checks. Synchronize with configure, which no longer defines HAVE_STDBOOL_H. There is still a reference to in an earlier test to see if we need -std=c99 to get C99 features, like autoconf 2

pgsql: Clean up reference in meson.build.

2024-11-25 Thread Thomas Munro
Clean up reference in meson.build. Commit bc5a4dfc accidentally left a check for in meson.build's header_checks. Synchronize with configure, which no longer defines HAVE_STDBOOL_H. There is still a reference to in an earlier test to see if we need -std=c99 to get C99 features, like autoconf 2

pgsql: Clean up reference in meson.build.

2024-11-25 Thread Thomas Munro
Clean up reference in meson.build. Commit bc5a4dfc accidentally left a check for in meson.build's header_checks. Synchronize with configure, which no longer defines HAVE_STDBOOL_H. There is still a reference to in an earlier test to see if we need -std=c99 to get C99 features, like autoconf 2

pgsql: Update configure probes for CFLAGS needed for ARM CRC instructio

2024-11-25 Thread Tom Lane
Update configure probes for CFLAGS needed for ARM CRC instructions. On ARM platforms where the baseline CPU target lacks CRC instructions, we need to supply a -march flag to persuade the compiler to compile such instructions. It turns out that our existing choice of "-march=armv8-a+crc" has not w

pgsql: Update configure probes for CFLAGS needed for ARM CRC instructio

2024-11-25 Thread Tom Lane
Update configure probes for CFLAGS needed for ARM CRC instructions. On ARM platforms where the baseline CPU target lacks CRC instructions, we need to supply a -march flag to persuade the compiler to compile such instructions. It turns out that our existing choice of "-march=armv8-a+crc" has not w

pgsql: Update configure probes for CFLAGS needed for ARM CRC instructio

2024-11-25 Thread Tom Lane
Update configure probes for CFLAGS needed for ARM CRC instructions. On ARM platforms where the baseline CPU target lacks CRC instructions, we need to supply a -march flag to persuade the compiler to compile such instructions. It turns out that our existing choice of "-march=armv8-a+crc" has not w

pgsql: Update configure probes for CFLAGS needed for ARM CRC instructio

2024-11-25 Thread Tom Lane
Update configure probes for CFLAGS needed for ARM CRC instructions. On ARM platforms where the baseline CPU target lacks CRC instructions, we need to supply a -march flag to persuade the compiler to compile such instructions. It turns out that our existing choice of "-march=armv8-a+crc" has not w

pgsql: Update configure probes for CFLAGS needed for ARM CRC instructio

2024-11-25 Thread Tom Lane
Update configure probes for CFLAGS needed for ARM CRC instructions. On ARM platforms where the baseline CPU target lacks CRC instructions, we need to supply a -march flag to persuade the compiler to compile such instructions. It turns out that our existing choice of "-march=armv8-a+crc" has not w

pgsql: Update configure probes for CFLAGS needed for ARM CRC instructio

2024-11-25 Thread Tom Lane
Update configure probes for CFLAGS needed for ARM CRC instructions. On ARM platforms where the baseline CPU target lacks CRC instructions, we need to supply a -march flag to persuade the compiler to compile such instructions. It turns out that our existing choice of "-march=armv8-a+crc" has not w

pgsql: Support runtime CRC feature probing on NetBSD/ARM using sysctl()

2024-11-25 Thread Tom Lane
Support runtime CRC feature probing on NetBSD/ARM using sysctl(). Commit aac831caf left this as a to-do; here's code to do it. Like the previous patch, this is HEAD-only for now. Discussion: https://postgr.es/m/4496616.iHFcN1HehY@portable-bastien Branch -- master Details --- https://git

pgsql: Add support for Tcl 9

2024-11-25 Thread Peter Eisentraut
Add support for Tcl 9 Tcl 9 changed several API functions to take Tcl_Size, which is ptrdiff_t, instead of int, for 64-bit enablement. We have to change a few local variables to be compatible with that. We also provide a fallback typedef of Tcl_Size for older Tcl versions. The affected variable

pgsql: Add support for Tcl 9

2024-11-25 Thread Peter Eisentraut
Add support for Tcl 9 Tcl 9 changed several API functions to take Tcl_Size, which is ptrdiff_t, instead of int, for 64-bit enablement. We have to change a few local variables to be compatible with that. We also provide a fallback typedef of Tcl_Size for older Tcl versions. The affected variable

pgsql: Add support for Tcl 9

2024-11-25 Thread Peter Eisentraut
Add support for Tcl 9 Tcl 9 changed several API functions to take Tcl_Size, which is ptrdiff_t, instead of int, for 64-bit enablement. We have to change a few local variables to be compatible with that. We also provide a fallback typedef of Tcl_Size for older Tcl versions. The affected variable

pgsql: Add support for Tcl 9

2024-11-25 Thread Peter Eisentraut
Add support for Tcl 9 Tcl 9 changed several API functions to take Tcl_Size, which is ptrdiff_t, instead of int, for 64-bit enablement. We have to change a few local variables to be compatible with that. We also provide a fallback typedef of Tcl_Size for older Tcl versions. The affected variable

pgsql: Add support for Tcl 9

2024-11-25 Thread Peter Eisentraut
Add support for Tcl 9 Tcl 9 changed several API functions to take Tcl_Size, which is ptrdiff_t, instead of int, for 64-bit enablement. We have to change a few local variables to be compatible with that. We also provide a fallback typedef of Tcl_Size for older Tcl versions. The affected variable

pgsql: Add support for Tcl 9

2024-11-25 Thread Peter Eisentraut
Add support for Tcl 9 Tcl 9 changed several API functions to take Tcl_Size, which is ptrdiff_t, instead of int, for 64-bit enablement. We have to change a few local variables to be compatible with that. We also provide a fallback typedef of Tcl_Size for older Tcl versions. The affected variable

pgsql: Assume that conforms to the C standard.

2024-11-25 Thread Thomas Munro
Assume that conforms to the C standard. Previously we checked "for that conforms to C99" using autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL 12, so the test was redundant, and under C23 it was broken: autoconf 2.69's implementation doesn't understand C23's new empty he

pgsql: Assume that conforms to the C standard.

2024-11-25 Thread Thomas Munro
Assume that conforms to the C standard. Previously we checked "for that conforms to C99" using autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL 12, so the test was redundant, and under C23 it was broken: autoconf 2.69's implementation doesn't understand C23's new empty he