Re: get date in binary number format

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: get date in binary number format
Дата
Msg-id Pine.LNX.4.44.0209270021040.27017-100000@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: get date in binary number format  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: get date in binary number format  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane dijo:

> Alvaro Herrera <alvherre@atentus.com> writes:
> > Is there a way to cast these bitstrings into varchars or something?  I
> > can't find any.
>
> regression=# select ("bit"((date_part('doy', now()))::integer))::text;
> ERROR:  Cannot cast type bit to text

Well, there is:

testing=> select varcharin(bit_out(bitv), 0, length(bitv)+4  )  FROM
(select "bit"(1) AS bitv) as t;
            varcharin
----------------------------------
 00000000000000000000000000000001
(1 row)

So going back to Shaunn's question, it's rather confusing to set
everything up (you'll have to use cut'n pasting from this message and my
previous followup), BUT it doesn't work in previous releases (only in
7.3beta).  Maybe you can adapt it, but it's not clear to me that the
casting from bit to varchar is possible in 7.2.

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"La realidad se compone de muchos sueños, todos ellos diferentes,
pero en cierto aspecto, parecidos..." (Yo, hablando de sueños eróticos)


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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: SQL subquery to supply table name?
Следующее
От: "Matt Wagner"
Дата:
Сообщение: Quick Pg/PLSQL question