Re: Planning error in dynamic string creation in plpgsql

Поиск
Список
Период
Сортировка
От Keith Fiske
Тема Re: Planning error in dynamic string creation in plpgsql
Дата
Msg-id CAG1_KcBmta1zyrHABj5A-FAg5888MT-tT994joBifb-JDMDS4w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Planning error in dynamic string creation in plpgsql  (Adrian Klaver <adrian.klaver@gmail.com>)
Ответы Re: Planning error in dynamic string creation in plpgsql
Список pgsql-general
I can't remove the quote_literal() because the value could potentially be a string, time, or number. Without the loop, quote_literal() handles the variable being any one of those types without any issues and quotes (or doesn't) as needed.

--
Keith Fiske
Database Administrator
OmniTI Computer Consulting, Inc.
http://www.keithf4.com


On Sun, Jan 5, 2014 at 11:40 PM, Adrian Klaver <adrian.klaver@gmail.com> wrote:
On 01/05/2014 08:34 PM, Keith Fiske wrote:
Actually, that doesn't work right. Gives weird results when the column
is an integer

Example:

keith=# select min(col1), max(col1) from
partman_test.time_static_table_p2014_01_01;
  min | max
-----+-----
   86 | 100
(1 row)

keith=# select min(col1::text), max(col1::text) from
partman_test.time_static_table_p2014_01_01;
  min | max
-----+-----
  100 | 99
(1 row)


Because it is working on a string in the second case. In the function remove the quote_literal() and see if that works.






--
Adrian Klaver
adrian.klaver@gmail.com

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Planning error in dynamic string creation in plpgsql
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Planning error in dynamic string creation in plpgsql