Re: COPY FROM WHEN condition

From: Surafel Temesgen <surafel3000(at)gmail(dot)com>
To: sawada(dot)mshk(at)gmail(dot)com
Cc: tomas(dot)vondra(at)2ndquadrant(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: COPY FROM WHEN condition
Date: 2018-11-02 11:23:19
Message-ID: CALAY4q-F2Ds4+tkeR6MZ_h1T8oPbQMLeP=u6R7goXAHXpakMcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi,

On Wed, Oct 31, 2018 at 10:54 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
wrote:

> On Tue, Oct 30, 2018 at 11:47 PM Surafel Temesgen <surafel3000(at)gmail(dot)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

Attachment Content-Type Size
copy_from_when_con_v3.patch text/x-patch 15.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Verite 2018-11-02 11:58:12 Re: COPY FROM WHEN condition
Previous Message Amit Kapila 2018-11-02 11:22:58 Re: WIP: Avoid creation of the free space map for small tables