Content-Length: 283952 | pFad | http://github.com/postgrespro/postgres/commit/b85e91023bf3fd5b4dbd35dc3eddbf0dc291c8ad

DF Don't try to read default for a non-existent attribute · postgrespro/postgres@b85e910 · GitHub
Skip to content

Commit b85e910

Browse files
committed
Don't try to read default for a non-existent attribute
Oversight in commit 9f8377f for COPY .. DEFAULT per report from Alexander Lakhin
1 parent 483bdb2 commit b85e910

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/commands/copyfromparse.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,8 @@ CopyReadAttributesText(CopyFromState cstate)
16831683
strncmp(start_ptr, cstate->opts.null_print, input_len) == 0)
16841684
cstate->raw_fields[fieldno] = NULL;
16851685
/* Check whether raw input matched default marker */
1686-
else if (cstate->opts.default_print &&
1686+
else if (fieldno < list_length(cstate->attnumlist) &&
1687+
cstate->opts.default_print &&
16871688
input_len == cstate->opts.default_print_len &&
16881689
strncmp(start_ptr, cstate->opts.default_print, input_len) == 0)
16891690
{
@@ -1897,7 +1898,8 @@ CopyReadAttributesCSV(CopyFromState cstate)
18971898
strncmp(start_ptr, cstate->opts.null_print, input_len) == 0)
18981899
cstate->raw_fields[fieldno] = NULL;
18991900
/* Check whether raw input matched default marker */
1900-
else if (cstate->opts.default_print &&
1901+
else if (fieldno < list_length(cstate->attnumlist) &&
1902+
cstate->opts.default_print &&
19011903
input_len == cstate->opts.default_print_len &&
19021904
strncmp(start_ptr, cstate->opts.default_print, input_len) == 0)
19031905
{

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/b85e91023bf3fd5b4dbd35dc3eddbf0dc291c8ad

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy