Re: Postgres Wishlist

Поиск
Список
Период
Сортировка
От Donald Kerr
Тема Re: Postgres Wishlist
Дата
Msg-id 2AD99D319C894638AF192798318FB445@DELLM4500
обсуждение исходный текст
Ответ на Re: Postgres Wishlist  (Michael Glaesemann <grzm@seespotcode.net>)
Ответы Re: Postgres Wishlist  (Mladen Gogala <mladen.gogala@vmsinfo.com>)
Список pgsql-novice
Michael,

First class :) Problem solved!!!

=======================
SELECT col, ('x'||substring(col,1,2))::text::bit(8)::int || ' ' ||
('x'||substring(col,3,2))::text::bit(8)::int || ' ' ||
('x'||substring(col,1,2))::text::bit(8)::int AS oscolor FROM
cartographictext WHERE COL <> '000000' LIMIT 10

Returns:
"0099FF";"0 153 0"
"FF00FF";"255 0 255"
Etc.

Thank you very much to everyone who helped me with this problem.

Regards,

Donald




-----Original Message-----
From: Michael Glaesemann [mailto:grzm@seespotcode.net]
Sent: 13 November 2010 08:45
To: Donald Kerr
Cc: 'Tom Lane'; 'Steve Crawford'; pgsql-novice@postgresql.org
Subject: Re: [NOVICE] Postgres Wishlist



On Nov 13, 2010, at 3:32 , Donald Kerr wrote:

> Thank you, Tom.
>
> I have tried what you suggest but it does not seem to work:
> 'x'||substring(col,3,2)::text::bit(8)::int returns - "9" is not a
> valid binary digit.

Try with parens:

postgres=# select ('x' || 99::text)::bit(8)::int;
 int4
------
  153
(1 row)

postgres=# select version();
                                                                 version

----------------------------------------------------------------------------
--------------------------------------------------------------
 PostgreSQL 9.0.1 on x86_64-apple-darwin10.4.0, compiled by GCC
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664), 64-bit (1
row)


Michael Glaesemann
grzm seespotcode net


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

Предыдущее
От: "Donald Kerr"
Дата:
Сообщение: Re: Postgres Wishlist
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: Postgres Wishlist