Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8e621c1

Browse files
committed
Remove code handling FORCE_NULL and FORCE_NOT_NULL for COPY TO
These two options are only available with COPY FROM, so the extra logicin charge of checking the validity of the attributes given has nopurpose.Author: Zhang MingliReviewed-by: Richard Guo, Kyotaro HoriguchiDiscussion:https://postgr.es/m/F28F0B5A-766F-4D33-BF44-43B3A052D833@gmail.com
1 parent7c335b7 commit8e621c1

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

‎src/backend/commands/copyto.c‎

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -608,52 +608,6 @@ BeginCopyTo(ParseState *pstate,
608608
}
609609
}
610610

611-
/* Convert FORCE_NOT_NULL name list to per-column flags, check validity */
612-
cstate->opts.force_notnull_flags= (bool*)palloc0(num_phys_attrs*sizeof(bool));
613-
if (cstate->opts.force_notnull)
614-
{
615-
List*attnums;
616-
ListCell*cur;
617-
618-
attnums=CopyGetAttnums(tupDesc,cstate->rel,cstate->opts.force_notnull);
619-
620-
foreach(cur,attnums)
621-
{
622-
intattnum=lfirst_int(cur);
623-
Form_pg_attributeattr=TupleDescAttr(tupDesc,attnum-1);
624-
625-
if (!list_member_int(cstate->attnumlist,attnum))
626-
ereport(ERROR,
627-
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
628-
errmsg("FORCE_NOT_NULL column \"%s\" not referenced by COPY",
629-
NameStr(attr->attname))));
630-
cstate->opts.force_notnull_flags[attnum-1]= true;
631-
}
632-
}
633-
634-
/* Convert FORCE_NULL name list to per-column flags, check validity */
635-
cstate->opts.force_null_flags= (bool*)palloc0(num_phys_attrs*sizeof(bool));
636-
if (cstate->opts.force_null)
637-
{
638-
List*attnums;
639-
ListCell*cur;
640-
641-
attnums=CopyGetAttnums(tupDesc,cstate->rel,cstate->opts.force_null);
642-
643-
foreach(cur,attnums)
644-
{
645-
intattnum=lfirst_int(cur);
646-
Form_pg_attributeattr=TupleDescAttr(tupDesc,attnum-1);
647-
648-
if (!list_member_int(cstate->attnumlist,attnum))
649-
ereport(ERROR,
650-
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
651-
errmsg("FORCE_NULL column \"%s\" not referenced by COPY",
652-
NameStr(attr->attname))));
653-
cstate->opts.force_null_flags[attnum-1]= true;
654-
}
655-
}
656-
657611
/* Use client encoding when ENCODING option is not specified. */
658612
if (cstate->opts.file_encoding<0)
659613
cstate->file_encoding=pg_get_client_encoding();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp