1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Provide FORCE_NULL * and FORCE_NOT_NULL * options for COPY FROM

These options already exist, but you need to specify a column list for
them, which can be cumbersome. We already have the possibility of all
columns for FORCE QUOTE, so this is simply extending that facility to
FORCE_NULL and FORCE_NOT_NULL.

Author: Zhang Mingli
Reviewed-By: Richard Guo, Kyatoro Horiguchi, Michael Paquier.

Discussion: https://postgr.es/m/CACJufxEnVqzOFtqhexF2+AwOKFrV8zHOY3y=p+gPK6eB14pn_w@mail.gmail.com
This commit is contained in:
Andrew Dunstan
2023-09-30 12:34:41 -04:00
parent c181f2e2bc
commit f6d4c9cf16
8 changed files with 103 additions and 12 deletions

View File

@@ -3419,10 +3419,18 @@ copy_opt_item:
{
$$ = makeDefElem("force_not_null", (Node *) $4, @1);
}
| FORCE NOT NULL_P '*'
{
$$ = makeDefElem("force_not_null", (Node *) makeNode(A_Star), @1);
}
| FORCE NULL_P columnList
{
$$ = makeDefElem("force_null", (Node *) $3, @1);
}
| FORCE NULL_P '*'
{
$$ = makeDefElem("force_null", (Node *) makeNode(A_Star), @1);
}
| ENCODING Sconst
{
$$ = makeDefElem("encoding", (Node *) makeString($2), @1);