Re: Passing array of range literals

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: Passing array of range literals
Дата
Msg-id 1395427909148-5797062.post@n5.nabble.com
обсуждение исходный текст
Ответ на Passing array of range literals  (Glenn Pierce <glennpierce@gmail.com>)
Список pgsql-general
Glenn Pierce wrote
> I cannot work out how to pass a literal for the array of timerange types.
> '{(15:11:21, 18:11:21)}'::timerange[] does not work for example.
> Also I can not pass NULL for this parameter I get

since NULL can take on any type if you pass it literally you have to specify
the type you need:

NULL::timerange[]

Though I'd suggest passing in an empty array instead:

ARRAY[]::timerange[]

Note this is also the best way to construct the array:

ARRAY['(15:11:21,18:11:21)','(19.11.22,21:12:17]']::timerange[]

Otherwise you need to use double-quotes somewhere.  Once you construct an
array as above just cast it to text and let PostgreSQL tell you what the
text representation would look like if you cannot use the ARRAY[] form.

David J.



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Passing-array-of-range-literals-tp5797031p5797062.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: Ken Barber
Дата:
Сообщение: General Advice for avoiding concurrency during schema migrations
Следующее
От: Shaun Thomas
Дата:
Сообщение: Introducing walctl, a simple tool for safe WAL management