pgsql: Fix bugs in libpq's management of GSS encryption state.

2020-07-13 Thread Tom Lane
Fix bugs in libpq's management of GSS encryption state. GSS-related resources should be cleaned up in pqDropConnection, not freePGconn, else the wrong things happen when resetting a connection or trying to switch to a different server. It's also critical to reset conn->gssenc there. During connec

pgsql: Improvements to psql \dAo and \dAp commands

2020-07-13 Thread Alexander Korotkov
Improvements to psql \dAo and \dAp commands * Strategy number and purpose are essential information for opfamily operator. So, show those columns in non-verbose output. * "Left/right arg type" \dAp column names are confusing, because those type don't necessary match to function arguments.

pgsql: Improvements to psql \dAo and \dAp commands

2020-07-13 Thread Alexander Korotkov
Improvements to psql \dAo and \dAp commands * Strategy number and purpose are essential information for opfamily operator. So, show those columns in non-verbose output. * "Left/right arg type" \dAp column names are confusing, because those type don't necessary match to function arguments.

pgsql: Fix bugs in libpq's management of GSS encryption state.

2020-07-13 Thread Tom Lane
Fix bugs in libpq's management of GSS encryption state. GSS-related resources should be cleaned up in pqDropConnection, not freePGconn, else the wrong things happen when resetting a connection or trying to switch to a different server. It's also critical to reset conn->gssenc there. During connec

pgsql: Fix bugs in libpq's management of GSS encryption state.

2020-07-13 Thread Tom Lane
Fix bugs in libpq's management of GSS encryption state. GSS-related resources should be cleaned up in pqDropConnection, not freePGconn, else the wrong things happen when resetting a connection or trying to switch to a different server. It's also critical to reset conn->gssenc there. During connec

Re: pgsql: Improvements to psql \dAo and \dAp commands

2020-07-13 Thread Alexander Korotkov
On Mon, Jul 13, 2020 at 6:57 PM Alexander Korotkov wrote: > Improvements to psql \dAo and \dAp commands Oops, I've just pushed the commit with timestamp too far in the past. Sorry for that. -- Regards, Alexander Korotkov

pgsql: Fix uninitialized value in segno calculation

2020-07-13 Thread Alvaro Herrera
Fix uninitialized value in segno calculation Remove previous hack in KeepLogSeg that added a case to deal with a (badly represented) invalid segment number. This was added for the sake of GetWALAvailability. But it's not needed if in that function we initialize the segment number to be retreated

pgsql: Fix uninitialized value in segno calculation

2020-07-13 Thread Alvaro Herrera
Fix uninitialized value in segno calculation Remove previous hack in KeepLogSeg that added a case to deal with a (badly represented) invalid segment number. This was added for the sake of GetWALAvailability. But it's not needed if in that function we initialize the segment number to be retreated

Re: pgsql: Improvements to psql \dAo and \dAp commands

2020-07-13 Thread Tom Lane
Alexander Korotkov writes: > On Mon, Jul 13, 2020 at 6:57 PM Alexander Korotkov > wrote: >> Improvements to psql \dAo and \dAp commands > Oops, I've just pushed the commit with timestamp too far in the past. > Sorry for that. Some committers use workflows where the author-date is regularly well

Re: pgsql: Improvements to psql \dAo and \dAp commands

2020-07-13 Thread Alexander Korotkov
On Mon, Jul 13, 2020 at 10:39 PM Tom Lane wrote: > Alexander Korotkov writes: > > On Mon, Jul 13, 2020 at 6:57 PM Alexander Korotkov > > wrote: > >> Improvements to psql \dAo and \dAp commands > > > Oops, I've just pushed the commit with timestamp too far in the past. > > Sorry for that. > > Som

pgsql: Cope with lateral references in the quals of a subquery RTE.

2020-07-13 Thread Tom Lane
Cope with lateral references in the quals of a subquery RTE. The qual pushdown logic assumed that all Vars in a restriction clause must be Vars referencing subquery outputs; but since we introduced LATERAL, it's possible for such a Var to be a lateral reference instead. This led to an assertion fa

pgsql: Cope with lateral references in the quals of a subquery RTE.

2020-07-13 Thread Tom Lane
Cope with lateral references in the quals of a subquery RTE. The qual pushdown logic assumed that all Vars in a restriction clause must be Vars referencing subquery outputs; but since we introduced LATERAL, it's possible for such a Var to be a lateral reference instead. This led to an assertion fa

pgsql: Cope with lateral references in the quals of a subquery RTE.

2020-07-13 Thread Tom Lane
Cope with lateral references in the quals of a subquery RTE. The qual pushdown logic assumed that all Vars in a restriction clause must be Vars referencing subquery outputs; but since we introduced LATERAL, it's possible for such a Var to be a lateral reference instead. This led to an assertion fa

pgsql: Cope with lateral references in the quals of a subquery RTE.

2020-07-13 Thread Tom Lane
Cope with lateral references in the quals of a subquery RTE. The qual pushdown logic assumed that all Vars in a restriction clause must be Vars referencing subquery outputs; but since we introduced LATERAL, it's possible for such a Var to be a lateral reference instead. This led to an assertion fa

pgsql: Cope with lateral references in the quals of a subquery RTE.

2020-07-13 Thread Tom Lane
Cope with lateral references in the quals of a subquery RTE. The qual pushdown logic assumed that all Vars in a restriction clause must be Vars referencing subquery outputs; but since we introduced LATERAL, it's possible for such a Var to be a lateral reference instead. This led to an assertion fa

pgsql: Cope with lateral references in the quals of a subquery RTE.

2020-07-13 Thread Tom Lane
Cope with lateral references in the quals of a subquery RTE. The qual pushdown logic assumed that all Vars in a restriction clause must be Vars referencing subquery outputs; but since we introduced LATERAL, it's possible for such a Var to be a lateral reference instead. This led to an assertion fa

pgsql: Cope with lateral references in the quals of a subquery RTE.

2020-07-13 Thread Tom Lane
Cope with lateral references in the quals of a subquery RTE. The qual pushdown logic assumed that all Vars in a restriction clause must be Vars referencing subquery outputs; but since we introduced LATERAL, it's possible for such a Var to be a lateral reference instead. This led to an assertion fa

pgsql: Fix comments related to table AMs

2020-07-13 Thread Michael Paquier
Fix comments related to table AMs Incorrect function names were referenced. As this fixes some portions of tableam.h, that is mentioned in the docs as something to look at when implementing a table AM, backpatch down to 12 where this has been introduced. Author: Hironobu Suzuki Discussion: https

pgsql: Fix comments related to table AMs

2020-07-13 Thread Michael Paquier
Fix comments related to table AMs Incorrect function names were referenced. As this fixes some portions of tableam.h, that is mentioned in the docs as something to look at when implementing a table AM, backpatch down to 12 where this has been introduced. Author: Hironobu Suzuki Discussion: https

pgsql: Fix comments related to table AMs

2020-07-13 Thread Michael Paquier
Fix comments related to table AMs Incorrect function names were referenced. As this fixes some portions of tableam.h, that is mentioned in the docs as something to look at when implementing a table AM, backpatch down to 12 where this has been introduced. Author: Hironobu Suzuki Discussion: https

pgsql: Fix some header identifications

2020-07-13 Thread Michael Paquier
Fix some header identifications The following header files missed the shot: - jsonfuncs.h, as of ce0425b. - jsonapi.h, as of beb4699. - llvmjit_emit.h as of 7ec0d80. - partdesc.h, as of 1bb5e78. Author: Jesse Zhang Discussion: https://postgr.es/m/cagf+fx4-8xuleoz09de2dzgjt+q8vj--rqftpvcfwc+a4fc.

pgsql: Fix timing issue with ALTER TABLE's validate constraint

2020-07-13 Thread David Rowley
Fix timing issue with ALTER TABLE's validate constraint An ALTER TABLE to validate a foreign key in which another subcommand already caused a pending table rewrite could fail due to ALTER TABLE attempting to validate the foreign key before the actual table rewrite takes place. This situation coul

pgsql: Fix timing issue with ALTER TABLE's validate constraint

2020-07-13 Thread David Rowley
Fix timing issue with ALTER TABLE's validate constraint An ALTER TABLE to validate a foreign key in which another subcommand already caused a pending table rewrite could fail due to ALTER TABLE attempting to validate the foreign key before the actual table rewrite takes place. This situation coul

pgsql: Fix timing issue with ALTER TABLE's validate constraint

2020-07-13 Thread David Rowley
Fix timing issue with ALTER TABLE's validate constraint An ALTER TABLE to validate a foreign key in which another subcommand already caused a pending table rewrite could fail due to ALTER TABLE attempting to validate the foreign key before the actual table rewrite takes place. This situation coul

pgsql: Fix timing issue with ALTER TABLE's validate constraint

2020-07-13 Thread David Rowley
Fix timing issue with ALTER TABLE's validate constraint An ALTER TABLE to validate a foreign key in which another subcommand already caused a pending table rewrite could fail due to ALTER TABLE attempting to validate the foreign key before the actual table rewrite takes place. This situation coul

pgsql: Fix timing issue with ALTER TABLE's validate constraint

2020-07-13 Thread David Rowley
Fix timing issue with ALTER TABLE's validate constraint An ALTER TABLE to validate a foreign key in which another subcommand already caused a pending table rewrite could fail due to ALTER TABLE attempting to validate the foreign key before the actual table rewrite takes place. This situation coul

pgsql: Fix timing issue with ALTER TABLE's validate constraint

2020-07-13 Thread David Rowley
Fix timing issue with ALTER TABLE's validate constraint An ALTER TABLE to validate a foreign key in which another subcommand already caused a pending table rewrite could fail due to ALTER TABLE attempting to validate the foreign key before the actual table rewrite takes place. This situation coul

pgsql: Fix timing issue with ALTER TABLE's validate constraint

2020-07-13 Thread David Rowley
Fix timing issue with ALTER TABLE's validate constraint An ALTER TABLE to validate a foreign key in which another subcommand already caused a pending table rewrite could fail due to ALTER TABLE attempting to validate the foreign key before the actual table rewrite takes place. This situation coul

pgsql: Add comment to explain an unused function parameter

2020-07-13 Thread David Rowley
Add comment to explain an unused function parameter Removing the unused 'miinfo' parameter has been raised a couple of times now. It was decided in the 2nd discussion below that we're going to leave it alone. It seems like it might be useful to add a comment to mention this fact so that nobody w