pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.

2021-10-01 Thread Andres Freund
Reference test binary using TESTDIR in 001_libpq_pipeline.pl. The previous approach didn't really work on windows, due to the PATH separator being ';' not ':'. Instead of making the PATH change more complicated, reference the binary using the TESTDIR environment. Reported-By: Andres Freund Sugge

pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.

2021-10-01 Thread Andres Freund
Reference test binary using TESTDIR in 001_libpq_pipeline.pl. The previous approach didn't really work on windows, due to the PATH separator being ';' not ':'. Instead of making the PATH change more complicated, reference the binary using the TESTDIR environment. Reported-By: Andres Freund Sugge

pgsql: Error out if SKIP LOCKED and WITH TIES are both specified

2021-10-01 Thread Alvaro Herrera
Error out if SKIP LOCKED and WITH TIES are both specified Both bugs #16676[1] and #17141[2] illustrate that the combination of SKIP LOCKED and FETCH FIRST WITH TIES break expectations when it comes to rows returned to other sessions accessing the same row. Since this situation is detectable from

pgsql: Error out if SKIP LOCKED and WITH TIES are both specified

2021-10-01 Thread Alvaro Herrera
Error out if SKIP LOCKED and WITH TIES are both specified Both bugs #16676[1] and #17141[2] illustrate that the combination of SKIP LOCKED and FETCH FIRST WITH TIES break expectations when it comes to rows returned to other sessions accessing the same row. Since this situation is detectable from

pgsql: Error out if SKIP LOCKED and WITH TIES are both specified

2021-10-01 Thread Alvaro Herrera
Error out if SKIP LOCKED and WITH TIES are both specified Both bugs #16676[1] and #17141[2] illustrate that the combination of SKIP LOCKED and FETCH FIRST WITH TIES break expectations when it comes to rows returned to other sessions accessing the same row. Since this situation is detectable from

pgsql: Remove unstable, unnecessary test; fix typo

2021-10-01 Thread Alvaro Herrera
Remove unstable, unnecessary test; fix typo Commit ff9f111bce24 added some test code that's unportable and doesn't add meaningful coverage. Remove it rather than try and get it to work everywhere. While at it, fix a typo in a log message added by the aforementioned commit. Backpatch to 14. Dis

pgsql: Remove unstable, unnecessary test; fix typo

2021-10-01 Thread Alvaro Herrera
Remove unstable, unnecessary test; fix typo Commit ff9f111bce24 added some test code that's unportable and doesn't add meaningful coverage. Remove it rather than try and get it to work everywhere. While at it, fix a typo in a log message added by the aforementioned commit. Backpatch to 14. Dis

pgsql: Fix memory leak in pg_hmac

2021-10-01 Thread Daniel Gustafsson
Fix memory leak in pg_hmac The intermittent h buffer was not freed, causing it to leak. Backpatch through 14 where HMAC was refactored to the current API. Author: Sergey Shinderuk Discussion: https://postgr.es/m/[email protected] Backpatch-through: 14 Branch -

pgsql: Fix memory leak in pg_hmac

2021-10-01 Thread Daniel Gustafsson
Fix memory leak in pg_hmac The intermittent h buffer was not freed, causing it to leak. Backpatch through 14 where HMAC was refactored to the current API. Author: Sergey Shinderuk Discussion: https://postgr.es/m/[email protected] Backpatch-through: 14 Branch -

pgsql: Avoid believing incomplete MCV-only stats in get_variable_range(

2021-10-01 Thread Tom Lane
Avoid believing incomplete MCV-only stats in get_variable_range(). get_variable_range() would incautiously believe that statistics containing only an MCV list are sufficient to derive a range estimate. That's okay for an enum-like column that contains only MCVs, but otherwise the estimate could be

pgsql: Avoid believing incomplete MCV-only stats in get_variable_range(

2021-10-01 Thread Tom Lane
Avoid believing incomplete MCV-only stats in get_variable_range(). get_variable_range() would incautiously believe that statistics containing only an MCV list are sufficient to derive a range estimate. That's okay for an enum-like column that contains only MCVs, but otherwise the estimate could be

pgsql: Avoid believing incomplete MCV-only stats in get_variable_range(

2021-10-01 Thread Tom Lane
Avoid believing incomplete MCV-only stats in get_variable_range(). get_variable_range() would incautiously believe that statistics containing only an MCV list are sufficient to derive a range estimate. That's okay for an enum-like column that contains only MCVs, but otherwise the estimate could be

pgsql: Avoid believing incomplete MCV-only stats in get_variable_range(

2021-10-01 Thread Tom Lane
Avoid believing incomplete MCV-only stats in get_variable_range(). get_variable_range() would incautiously believe that statistics containing only an MCV list are sufficient to derive a range estimate. That's okay for an enum-like column that contains only MCVs, but otherwise the estimate could be

pgsql: Avoid believing incomplete MCV-only stats in get_variable_range(

2021-10-01 Thread Tom Lane
Avoid believing incomplete MCV-only stats in get_variable_range(). get_variable_range() would incautiously believe that statistics containing only an MCV list are sufficient to derive a range estimate. That's okay for an enum-like column that contains only MCVs, but otherwise the estimate could be

pgsql: Avoid believing incomplete MCV-only stats in get_variable_range(

2021-10-01 Thread Tom Lane
Avoid believing incomplete MCV-only stats in get_variable_range(). get_variable_range() would incautiously believe that statistics containing only an MCV list are sufficient to derive a range estimate. That's okay for an enum-like column that contains only MCVs, but otherwise the estimate could be

pgsql: Fix Portal snapshot tracking to handle subtransactions properly.

2021-10-01 Thread Tom Lane
Fix Portal snapshot tracking to handle subtransactions properly. Commit 84f5c2908 forgot to consider the possibility that EnsurePortalSnapshotExists could run inside a subtransaction with lifespan shorter than the Portal's. In that case, the new active snapshot would be popped at the end of the s

pgsql: Fix Portal snapshot tracking to handle subtransactions properly.

2021-10-01 Thread Tom Lane
Fix Portal snapshot tracking to handle subtransactions properly. Commit 84f5c2908 forgot to consider the possibility that EnsurePortalSnapshotExists could run inside a subtransaction with lifespan shorter than the Portal's. In that case, the new active snapshot would be popped at the end of the s

pgsql: Fix Portal snapshot tracking to handle subtransactions properly.

2021-10-01 Thread Tom Lane
Fix Portal snapshot tracking to handle subtransactions properly. Commit 84f5c2908 forgot to consider the possibility that EnsurePortalSnapshotExists could run inside a subtransaction with lifespan shorter than the Portal's. In that case, the new active snapshot would be popped at the end of the s

pgsql: Fix Portal snapshot tracking to handle subtransactions properly.

2021-10-01 Thread Tom Lane
Fix Portal snapshot tracking to handle subtransactions properly. Commit 84f5c2908 forgot to consider the possibility that EnsurePortalSnapshotExists could run inside a subtransaction with lifespan shorter than the Portal's. In that case, the new active snapshot would be popped at the end of the s

pgsql: Fix Portal snapshot tracking to handle subtransactions properly.

2021-10-01 Thread Tom Lane
Fix Portal snapshot tracking to handle subtransactions properly. Commit 84f5c2908 forgot to consider the possibility that EnsurePortalSnapshotExists could run inside a subtransaction with lifespan shorter than the Portal's. In that case, the new active snapshot would be popped at the end of the s