From: | sagar jadhav <sagarjdhv5(at)gmail(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Nikhil Ingale <niks(dot)bgm(at)gmail(dot)com>, "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org> |
Subject: | Re: failed to execute the psql case statement which has the function call. |
Date: | 2022-04-05 13:46:50 |
Message-ID: | CACPo9Dp=aq9cgn2ssyC6YFHsJ5Wbq1ZbRYNDJWeujerQa3TLVA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Use single quotes ('attribute') for variable in function.
On Tue, Apr 5, 2022 at 7:04 PM David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:
>
>
> On Tuesday, April 5, 2022, Nikhil Ingale <niks(dot)bgm(at)gmail(dot)com> wrote:
>
>> Hi All,
>>
>> I've a case statement where I'm calling the user defined postgres
>> function and failed to execute the same. Because it's assuming the variable
>> passed inside the function as a column for the table.
>>
>
> You cannot use variables for identifiers in raw sql. If you need to do
> that you must use dynamic sql - build a string using format and execute it.
>
> David J.
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2022-04-05 13:53:15 | Re: failed to execute the psql case statement which has the function call. |
Previous Message | David G. Johnston | 2022-04-05 13:34:24 | Re: failed to execute the psql case statement which has the function call. |