pgsql: Ensure correct lock level is used in ALTER ... RENAME

2021-10-19 Thread Alvaro Herrera
Ensure correct lock level is used in ALTER ... RENAME Commit 1b5d797cd4f7 intended to relax the lock level used to rename indexes, but inadvertently allowed *any* relation to be renamed with a lowered lock level, as long as the command is spelled ALTER INDEX. That's undesirable for other relation

pgsql: Ensure correct lock level is used in ALTER ... RENAME

2021-10-19 Thread Alvaro Herrera
Ensure correct lock level is used in ALTER ... RENAME Commit 1b5d797cd4f7 intended to relax the lock level used to rename indexes, but inadvertently allowed *any* relation to be renamed with a lowered lock level, as long as the command is spelled ALTER INDEX. That's undesirable for other relation

pgsql: Ensure correct lock level is used in ALTER ... RENAME

2021-10-19 Thread Alvaro Herrera
Ensure correct lock level is used in ALTER ... RENAME Commit 1b5d797cd4f7 intended to relax the lock level used to rename indexes, but inadvertently allowed *any* relation to be renamed with a lowered lock level, as long as the command is spelled ALTER INDEX. That's undesirable for other relation

pgsql: Ensure correct lock level is used in ALTER ... RENAME

2021-10-19 Thread Alvaro Herrera
Ensure correct lock level is used in ALTER ... RENAME Commit 1b5d797cd4f7 intended to relax the lock level used to rename indexes, but inadvertently allowed *any* relation to be renamed with a lowered lock level, as long as the command is spelled ALTER INDEX. That's undesirable for other relation

pgsql: pg_dump: Reorganize getTables()

2021-10-19 Thread Tom Lane
pg_dump: Reorganize getTables() Along the same lines as 047329624, ed2c7f65b and daa9fe8a5, reduce code duplication by having just one copy of the parts of the query that are the same across all server versions; and make the conditionals control the smallest possible amount of code. This also gets

pgsql: Adapt src/test/ldap/t/001_auth.pl to work with openldap 2.5.

2021-10-19 Thread Andres Freund
Adapt src/test/ldap/t/001_auth.pl to work with openldap 2.5. ldapsearch's deprecated -h/-p arguments were removed, need to use -H now - which has been around for over 20 years. As perltidy insists on reflowing the parameters anyway, change order and "phrasing" to yield a less confusing layout (pe

pgsql: Adapt src/test/ldap/t/001_auth.pl to work with openldap 2.5.

2021-10-19 Thread Andres Freund
Adapt src/test/ldap/t/001_auth.pl to work with openldap 2.5. ldapsearch's deprecated -h/-p arguments were removed, need to use -H now - which has been around for over 20 years. As perltidy insists on reflowing the parameters anyway, change order and "phrasing" to yield a less confusing layout (pe

pgsql: Adapt src/test/ldap/t/001_auth.pl to work with openldap 2.5.

2021-10-19 Thread Andres Freund
Adapt src/test/ldap/t/001_auth.pl to work with openldap 2.5. ldapsearch's deprecated -h/-p arguments were removed, need to use -H now - which has been around for over 20 years. As perltidy insists on reflowing the parameters anyway, change order and "phrasing" to yield a less confusing layout (pe

pgsql: Adapt src/test/ldap/t/001_auth.pl to work with openldap 2.5.

2021-10-19 Thread Andres Freund
Adapt src/test/ldap/t/001_auth.pl to work with openldap 2.5. ldapsearch's deprecated -h/-p arguments were removed, need to use -H now - which has been around for over 20 years. As perltidy insists on reflowing the parameters anyway, change order and "phrasing" to yield a less confusing layout (pe

pgsql: Adapt src/test/ldap/t/001_auth.pl to work with openldap 2.5.

2021-10-19 Thread Andres Freund
Adapt src/test/ldap/t/001_auth.pl to work with openldap 2.5. ldapsearch's deprecated -h/-p arguments were removed, need to use -H now - which has been around for over 20 years. As perltidy insists on reflowing the parameters anyway, change order and "phrasing" to yield a less confusing layout (pe

pgsql: Refactor the sslfiles Makefile target for ease of use

2021-10-19 Thread Daniel Gustafsson
Refactor the sslfiles Makefile target for ease of use The Makefile handling of certificate and keypairs used for TLS testing had become quite difficult to work with. Adding a new cert without the need to regenerate everything was too complicated. This patch refactors the sslfiles make target such

pgsql: Fix assignment to array of domain over composite.

2021-10-19 Thread Tom Lane
Fix assignment to array of domain over composite. An update such as "UPDATE ... SET fld[n].subfld = whatever" failed if the array elements were domains rather than plain composites. That's because isAssignmentIndirectionExpr() failed to cope with the CoerceToDomain node that would appear in the e

pgsql: Fix assignment to array of domain over composite.

2021-10-19 Thread Tom Lane
Fix assignment to array of domain over composite. An update such as "UPDATE ... SET fld[n].subfld = whatever" failed if the array elements were domains rather than plain composites. That's because isAssignmentIndirectionExpr() failed to cope with the CoerceToDomain node that would appear in the e

pgsql: Fix assignment to array of domain over composite.

2021-10-19 Thread Tom Lane
Fix assignment to array of domain over composite. An update such as "UPDATE ... SET fld[n].subfld = whatever" failed if the array elements were domains rather than plain composites. That's because isAssignmentIndirectionExpr() failed to cope with the CoerceToDomain node that would appear in the e

pgsql: Fix assignment to array of domain over composite.

2021-10-19 Thread Tom Lane
Fix assignment to array of domain over composite. An update such as "UPDATE ... SET fld[n].subfld = whatever" failed if the array elements were domains rather than plain composites. That's because isAssignmentIndirectionExpr() failed to cope with the CoerceToDomain node that would appear in the e

pgsql: Fix assignment to array of domain over composite.

2021-10-19 Thread Tom Lane
Fix assignment to array of domain over composite. An update such as "UPDATE ... SET fld[n].subfld = whatever" failed if the array elements were domains rather than plain composites. That's because isAssignmentIndirectionExpr() failed to cope with the CoerceToDomain node that would appear in the e

pgsql: Remove bogus assertion in transformExpressionList().

2021-10-19 Thread Tom Lane
Remove bogus assertion in transformExpressionList(). I think when I added this assertion (in commit 8f889b108), I was only thinking of the use of transformExpressionList at top level of INSERT and VALUES. But it's also called by transformRowExpr(), which can certainly occur in an UPDATE targetlis

pgsql: Remove bogus assertion in transformExpressionList().

2021-10-19 Thread Tom Lane
Remove bogus assertion in transformExpressionList(). I think when I added this assertion (in commit 8f889b108), I was only thinking of the use of transformExpressionList at top level of INSERT and VALUES. But it's also called by transformRowExpr(), which can certainly occur in an UPDATE targetlis

pgsql: Remove bogus assertion in transformExpressionList().

2021-10-19 Thread Tom Lane
Remove bogus assertion in transformExpressionList(). I think when I added this assertion (in commit 8f889b108), I was only thinking of the use of transformExpressionList at top level of INSERT and VALUES. But it's also called by transformRowExpr(), which can certainly occur in an UPDATE targetlis

pgsql: Remove bogus assertion in transformExpressionList().

2021-10-19 Thread Tom Lane
Remove bogus assertion in transformExpressionList(). I think when I added this assertion (in commit 8f889b108), I was only thinking of the use of transformExpressionList at top level of INSERT and VALUES. But it's also called by transformRowExpr(), which can certainly occur in an UPDATE targetlis

pgsql: Remove bogus assertion in transformExpressionList().

2021-10-19 Thread Tom Lane
Remove bogus assertion in transformExpressionList(). I think when I added this assertion (in commit 8f889b108), I was only thinking of the use of transformExpressionList at top level of INSERT and VALUES. But it's also called by transformRowExpr(), which can certainly occur in an UPDATE targetlis

pgsql: Remove bogus assertion in transformExpressionList().

2021-10-19 Thread Tom Lane
Remove bogus assertion in transformExpressionList(). I think when I added this assertion (in commit 8f889b108), I was only thinking of the use of transformExpressionList at top level of INSERT and VALUES. But it's also called by transformRowExpr(), which can certainly occur in an UPDATE targetlis

pgsql: Remove bogus assertion in transformExpressionList().

2021-10-19 Thread Tom Lane
Remove bogus assertion in transformExpressionList(). I think when I added this assertion (in commit 8f889b108), I was only thinking of the use of transformExpressionList at top level of INSERT and VALUES. But it's also called by transformRowExpr(), which can certainly occur in an UPDATE targetlis

pgsql: Fix bug in TOC file error message printing

2021-10-19 Thread Daniel Gustafsson
Fix bug in TOC file error message printing If the blob TOC file cannot be parsed, the error message was failing to print the filename as the variable holding it was shadowed by the destination buffer for parsing. When the filename fails to parse, the error will print an empty string: ./pg_resto

pgsql: Fix sscanf limits in pg_dump

2021-10-19 Thread Daniel Gustafsson
Fix sscanf limits in pg_dump Make sure that the string parsing is limited by the size of the destination buffer. The buffer is bounded by MAXPGPATH, and thus the limit must be inserted via preprocessor expansion and the buffer increased by one to account for the terminator. There is no risk of ov

pgsql: Fix bug in TOC file error message printing

2021-10-19 Thread Daniel Gustafsson
Fix bug in TOC file error message printing If the blob TOC file cannot be parsed, the error message was failing to print the filename as the variable holding it was shadowed by the destination buffer for parsing. When the filename fails to parse, the error will print an empty string: ./pg_resto

pgsql: Fix sscanf limits in pg_dump

2021-10-19 Thread Daniel Gustafsson
Fix sscanf limits in pg_dump Make sure that the string parsing is limited by the size of the destination buffer. The buffer is bounded by MAXPGPATH, and thus the limit must be inserted via preprocessor expansion and the buffer increased by one to account for the terminator. There is no risk of ov

pgsql: Fix sscanf limits in pg_basebackup and pg_dump

2021-10-19 Thread Daniel Gustafsson
Fix sscanf limits in pg_basebackup and pg_dump Make sure that the string parsing is limited by the size of the destination buffer. In pg_basebackup the available values sent from the server is limited to two characters so there was no risk of overflow. In pg_dump the buffer is bounded by MAXPGPA

pgsql: Fix bug in TOC file error message printing

2021-10-19 Thread Daniel Gustafsson
Fix bug in TOC file error message printing If the blob TOC file cannot be parsed, the error message was failing to print the filename as the variable holding it was shadowed by the destination buffer for parsing. When the filename fails to parse, the error will print an empty string: ./pg_resto

pgsql: Fix bug in TOC file error message printing

2021-10-19 Thread Daniel Gustafsson
Fix bug in TOC file error message printing If the blob TOC file cannot be parsed, the error message was failing to print the filename as the variable holding it was shadowed by the destination buffer for parsing. When the filename fails to parse, the error will print an empty string: ./pg_resto

pgsql: Fix sscanf limits in pg_basebackup and pg_dump

2021-10-19 Thread Daniel Gustafsson
Fix sscanf limits in pg_basebackup and pg_dump Make sure that the string parsing is limited by the size of the destination buffer. In pg_basebackup the available values sent from the server is limited to two characters so there was no risk of overflow. In pg_dump the buffer is bounded by MAXPGPA

pgsql: Fix sscanf limits in pg_basebackup and pg_dump

2021-10-19 Thread Daniel Gustafsson
Fix sscanf limits in pg_basebackup and pg_dump Make sure that the string parsing is limited by the size of the destination buffer. In pg_basebackup the available values sent from the server is limited to two characters so there was no risk of overflow. In pg_dump the buffer is bounded by MAXPGPA

pgsql: Fix bug in TOC file error message printing

2021-10-19 Thread Daniel Gustafsson
Fix bug in TOC file error message printing If the blob TOC file cannot be parsed, the error message was failing to print the filename as the variable holding it was shadowed by the destination buffer for parsing. When the filename fails to parse, the error will print an empty string: ./pg_resto

pgsql: Fix sscanf limits in pg_basebackup and pg_dump

2021-10-19 Thread Daniel Gustafsson
Fix sscanf limits in pg_basebackup and pg_dump Make sure that the string parsing is limited by the size of the destination buffer. In pg_basebackup the available values sent from the server is limited to two characters so there was no risk of overflow. In pg_dump the buffer is bounded by MAXPGPA

pgsql: Fix bug in TOC file error message printing

2021-10-19 Thread Daniel Gustafsson
Fix bug in TOC file error message printing If the blob TOC file cannot be parsed, the error message was failing to print the filename as the variable holding it was shadowed by the destination buffer for parsing. When the filename fails to parse, the error will print an empty string: ./pg_resto

pgsql: Fix sscanf limits in pg_basebackup and pg_dump

2021-10-19 Thread Daniel Gustafsson
Fix sscanf limits in pg_basebackup and pg_dump Make sure that the string parsing is limited by the size of the destination buffer. In pg_basebackup the available values sent from the server is limited to two characters so there was no risk of overflow. In pg_dump the buffer is bounded by MAXPGPA

pgsql: Fix bug in TOC file error message printing

2021-10-19 Thread Daniel Gustafsson
Fix bug in TOC file error message printing If the blob TOC file cannot be parsed, the error message was failing to print the filename as the variable holding it was shadowed by the destination buffer for parsing. When the filename fails to parse, the error will print an empty string: ./pg_resto