Re: COPY FROM WHEN condition
Surafel Temsgen <surafel3000@gmail.com>
From: Surafel Temesgen <surafel3000@gmail.com>
To: sawada.mshk@gmail.com
Cc: tomas.vondra@2ndquadrant.com, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2018-11-02T11:23:19Z
Lists: pgsql-hackers
Attachments
- copy_from_when_con_v3.patch (text/x-patch) patch v3
hi, On Wed, Oct 31, 2018 at 10:54 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > On Tue, Oct 30, 2018 at 11:47 PM Surafel Temesgen <surafel3000@gmail.com> > wrote: > > I've looked at this patch and tested. > > When I use a function returning string in WHEN clause I got the following > error: > > =# copy test from '/tmp/aaa.csv' (format 'csv') when (lower(t) = 'hello'); > ERROR: could not determine which collation to use for lower() function > HINT: Use the COLLATE clause to set the collation explicitly. > CONTEXT: COPY hoge, line 1: "1,hoge,2018-01-01" > > And then although I specified COLLATE I got an another error (127 = > T_CollateExpr): > > =# copy test from '/tmp/aaa.csv' (format 'csv') when (lower(t) collate > "en_US" = 'hello'); > ERROR: unrecognized node type: 127 > > This error doesn't happen if I put the similar condition in WHEN > clause for triggers. I think the patch needs to produce a reasonable > error message. > > The attached patch include a fix for it .can you confirm it regards Surafel
Commits
-
Remove unused struct member, enforce multi_insert callback presence.
- 57a7a3adfe4e 12.0 landed
-
Separate per-batch and per-tuple memory contexts in COPY
- 36a1281f86c0 12.0 landed
-
Fix handling of volatile expressions in COPY FROM ... WHERE
- 4a8283d0ec5a 12.0 landed
-
Allow COPY FROM to filter data using WHERE conditions
- 31f3817402da 12.0 landed
-
Remove obsolete netbsd dynloader code
- b68ff3ea672c 12.0 cited