Re: failed to execute the psql case statement which has the function call.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Nikhil Ingale <niks(dot)bgm(at)gmail(dot)com>
Cc: "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:34:24
Message-ID: CAKFQuwYBRbm_jqO4APypSLiYbqY=Qcx9d4XQc97H+KJK83SPvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message sagar jadhav 2022-04-05 13:46:50 Re: failed to execute the psql case statement which has the function call.
Previous Message hubert depesz lubaczewski 2022-04-05 09:07:21 Re: failed to execute the psql case statement which has the function call.