Re: How to ensure column names are double quoted while using execute format when building a stored procedure?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: How to ensure column names are double quoted while using execute format when building a stored procedure?
Дата
Msg-id CAKFQuwYF+_1NeaHu2yKSYbMqP3pDADM6p72q_u1JrqKxr4O8eA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to ensure column names are double quoted while using execute format when building a stored procedure?  (Shaozhong SHI <shishaozhong@gmail.com>)
Ответы Re: How to ensure column names are double quoted while using execute format when building a stored procedure?  (Shaozhong SHI <shishaozhong@gmail.com>)
Список pgsql-general
On Thu, Dec 16, 2021 at 2:11 PM Shaozhong SHI <shishaozhong@gmail.com> wrote:
When I used SQL identifier, it stopped working.  The command line gets interpreted as following:

insert into stats select "1" as id, 'count of nulls in "UNIQUE_REFERENCE_NUMBER"' as checks, count("""UNIQUE_REFERENCE_NUMBER""") from points_of_interest."pointx_v2_National_Coverage_Sep21" where """UNIQUE_REFERENCE_NUMBER""" is null

By using the correct type specification at each variable insertion you can get this to work.

Either do trial-and-error or actually reason through what is happening at each position and why it is either correct or wrong (build up the query in parts if that makes things easier).

David J.

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

Предыдущее
От: Shaozhong SHI
Дата:
Сообщение: Re: How to ensure column names are double quoted while using execute format when building a stored procedure?
Следующее
От: Shaozhong SHI
Дата:
Сообщение: Re: How to ensure column names are double quoted while using execute format when building a stored procedure?