Re: BUG #18774: Not the required output of the query used in the function(delete_from_table1) in postgresql9.4 - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #18774: Not the required output of the query used in the function(delete_from_table1) in postgresql9.4
Date
Msg-id CAKFQuwZZ8sbxm-uawXi_UOWLnd5oordYdLYpfif-UQPpwDr7kg@mail.gmail.com
Whole thread Raw
List pgsql-bugs
On Sunday, February 2, 2025, Rajni Bobal <rajnibobal@gmail.com> wrote:

as per the documentation, following query execute successfully :
EXECUTE 'SELECT count(*) FROM '    || quote_ident(tabname)    || ' WHERE inserted_by = $1 AND inserted <= $2'   INTO c   USING checked_user, checked_date;

HERE, $1 and $2 are strings and its values are substituted in the query. Please clarify, may be i am missing something.

Ask yourself why “quote_ident(tabname)” is used to insert the table name into the SQL string via concatenation instead of also using a number placeholder.

David J.

pgsql-bugs by date:

Previous
From: Rajni Bobal
Date:
Subject: Re: BUG #18774: Not the required output of the query used in the function(delete_from_table1) in postgresql9.4
Next
From: Álvaro Herrera
Date:
Subject: Re: BUG #18774: Not the required output of the query used in the function(delete_from_table1) in postgresql9.4