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

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #18774: Not the required output of the query used in the function(delete_from_table1) in postgresql9.4
Дата
Msg-id CAKFQuwah2ja1MorKbXy5QpZbwF6iGKsboAyKkPV0uyaiTr3tYQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #18774: Not the required output of the query used in the function(delete_from_table1) in postgresql9.4  (Rajni Bobal <rajnibobal@gmail.com>)
Ответы Re: BUG #18774: Not the required output of the query used in the function(delete_from_table1) in postgresql9.4
Список pgsql-bugs
You seem to have reversed which query you deem correct...

On Wed, Jan 22, 2025 at 8:59 AM Rajni Bobal <rajnibobal@gmail.com> wrote:

        || quote_ident(colname)
        || ' IN (SELECT '
        || quote_ident(colname)
        || ' FROM '
        || quote_ident(sel_tblname)

This deletes rows from the table depending upon finding the same value in colname in the subquery.


        ' where $1 in (select $1 from ' || quote_ident(sel_tblname) ||

This deletes rows from the table depending only upon finding at least one row in the subquery - the limit is basically pointless.  Since all rows return the value provided in $1, and $1 = $1.

So these indeed produce different results, as they should.  The "error" one is behaving exactly as it should.  If it doesn't do what you want - which is likely as it is a very unusual query - don't use it.

David J.

В списке pgsql-bugs по дате отправления: