Search Postgresql Archives

range type expression syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Seems I'm missing a trick trying to get rangetypes working:

No problem building the string:
select concat('''[', now()::date, ',', now()::date, ']''') testrange;
          testrange
---------------------------
 '[2015-02-26,2015-02-26]'
(1 row)

Bombed-out trying to turn this into a daterange:
postgres=# select concat('''[', now()::date, ',', now()::date, ']''')::daterange testrange;
ERROR:  malformed range literal: "'[2015-02-26,2015-02-26]'"
DETAIL:  Missing left parenthesis or bracket.

Is there a specific casting I need to apply in order to render a literal daterange from parameterized range elements?

/john


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux