pgsql: Revert "Add soft error handling to some expression nodes"

2023-10-01 Thread Amit Langote
Revert "Add soft error handling to some expression nodes" This reverts commit 7fbc75b26ed8ec70c729c5e7f8233896c54c900f. Looks like the LLVM additions may not be totally correct. Branch -- master Details ---

pgsql: Add soft error handling to some expression nodes

2023-10-01 Thread Amit Langote
Add soft error handling to some expression nodes This adjusts the expression evaluation code for CoerceViaIO and CoerceToDomain to handle errors softly if needed. For CoerceViaIo, this means using InputFunctionCallSafe(), which provides the option to handle errors softly, instead of calling the

pgsql: psql: Set variables from query result on failure when printing t

2023-10-01 Thread Michael Paquier
psql: Set variables from query result on failure when printing tuples SetResultVariables() was not getting called when "printing" a result that failed (see around PrintQueryResult), which would cause some variables to not be set, like ROW_COUNT, SQLSTATE or ERROR. This can be confusing as a

pgsql: Correct assertion and comments about XLogRecordMaxSize.

2023-10-01 Thread Noah Misch
Correct assertion and comments about XLogRecordMaxSize. The largest allocation, of xl_tot_len+8192, is in allocate_recordbuf(). Discussion: https://postgr.es/m/20230812211327.gb2326...@rfd.leadboat.com Branch -- master Details ---

pgsql: Fix datalen calculation in tsvectorrecv().

2023-10-01 Thread Tom Lane
Fix datalen calculation in tsvectorrecv(). After receiving position data for a lexeme, tsvectorrecv() advanced its "datalen" value by (npos+1)*sizeof(WordEntry) where the correct calculation is (npos+1)*sizeof(WordEntryPos). This accidentally failed to render the constructed tsvector invalid, but

pgsql: Fix datalen calculation in tsvectorrecv().

2023-10-01 Thread Tom Lane
Fix datalen calculation in tsvectorrecv(). After receiving position data for a lexeme, tsvectorrecv() advanced its "datalen" value by (npos+1)*sizeof(WordEntry) where the correct calculation is (npos+1)*sizeof(WordEntryPos). This accidentally failed to render the constructed tsvector invalid, but

pgsql: Fix datalen calculation in tsvectorrecv().

2023-10-01 Thread Tom Lane
Fix datalen calculation in tsvectorrecv(). After receiving position data for a lexeme, tsvectorrecv() advanced its "datalen" value by (npos+1)*sizeof(WordEntry) where the correct calculation is (npos+1)*sizeof(WordEntryPos). This accidentally failed to render the constructed tsvector invalid, but

pgsql: Fix datalen calculation in tsvectorrecv().

2023-10-01 Thread Tom Lane
Fix datalen calculation in tsvectorrecv(). After receiving position data for a lexeme, tsvectorrecv() advanced its "datalen" value by (npos+1)*sizeof(WordEntry) where the correct calculation is (npos+1)*sizeof(WordEntryPos). This accidentally failed to render the constructed tsvector invalid, but

pgsql: Fix datalen calculation in tsvectorrecv().

2023-10-01 Thread Tom Lane
Fix datalen calculation in tsvectorrecv(). After receiving position data for a lexeme, tsvectorrecv() advanced its "datalen" value by (npos+1)*sizeof(WordEntry) where the correct calculation is (npos+1)*sizeof(WordEntryPos). This accidentally failed to render the constructed tsvector invalid, but

pgsql: Fix datalen calculation in tsvectorrecv().

2023-10-01 Thread Tom Lane
Fix datalen calculation in tsvectorrecv(). After receiving position data for a lexeme, tsvectorrecv() advanced its "datalen" value by (npos+1)*sizeof(WordEntry) where the correct calculation is (npos+1)*sizeof(WordEntryPos). This accidentally failed to render the constructed tsvector invalid, but

pgsql: Fix datalen calculation in tsvectorrecv().

2023-10-01 Thread Tom Lane
Fix datalen calculation in tsvectorrecv(). After receiving position data for a lexeme, tsvectorrecv() advanced its "datalen" value by (npos+1)*sizeof(WordEntry) where the correct calculation is (npos+1)*sizeof(WordEntryPos). This accidentally failed to render the constructed tsvector invalid, but

pgsql: In COPY FROM, fail cleanly when unsupported encoding conversion

2023-10-01 Thread Tom Lane
In COPY FROM, fail cleanly when unsupported encoding conversion is needed. In recent releases, such cases fail with "cache lookup failed for function 0" rather than complaining that the conversion function doesn't exist as prior versions did. Seems to be a consequence of sloppy refactoring in

pgsql: In COPY FROM, fail cleanly when unsupported encoding conversion

2023-10-01 Thread Tom Lane
In COPY FROM, fail cleanly when unsupported encoding conversion is needed. In recent releases, such cases fail with "cache lookup failed for function 0" rather than complaining that the conversion function doesn't exist as prior versions did. Seems to be a consequence of sloppy refactoring in

pgsql: In COPY FROM, fail cleanly when unsupported encoding conversion

2023-10-01 Thread Tom Lane
In COPY FROM, fail cleanly when unsupported encoding conversion is needed. In recent releases, such cases fail with "cache lookup failed for function 0" rather than complaining that the conversion function doesn't exist as prior versions did. Seems to be a consequence of sloppy refactoring in

pgsql: In COPY FROM, fail cleanly when unsupported encoding conversion

2023-10-01 Thread Tom Lane
In COPY FROM, fail cleanly when unsupported encoding conversion is needed. In recent releases, such cases fail with "cache lookup failed for function 0" rather than complaining that the conversion function doesn't exist as prior versions did. Seems to be a consequence of sloppy refactoring in

pgsql: Only evaluate default values as required when doing COPY FROM

2023-10-01 Thread Andrew Dunstan
Only evaluate default values as required when doing COPY FROM Commit 9f8377f7a2 was a little too eager in fetching default values. Normally this would not matter, but if the default value is not valid for the type (e.g. a varchar that's too long) it caused an unnecessary error. Complaint and fix

pgsql: Only evaluate default values as required when doing COPY FROM

2023-10-01 Thread Andrew Dunstan
Only evaluate default values as required when doing COPY FROM Commit 9f8377f7a2 was a little too eager in fetching default values. Normally this would not matter, but if the default value is not valid for the type (e.g. a varchar that's too long) it caused an unnecessary error. Complaint and fix