Re: PG преобразу

From: Alex Gorbachenko <agent_007(at)immo(dot)ru>
To: pgsql-ru-general(at)postgresql(dot)org
Subject: Re: PG преобразу
Date: 2006-02-01 07:46:49
Message-ID: 20060201104649.483ae3fe@satellit.immo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-ru-general

On Tue, 31 Jan 2006 11:14:41 +0300 (MSK)
Serik wrote:

S>Создаю вьюшку, в запросе явно указываю ::varchar(100),
S>после выполнения на сервере это выглядит как ::text,
S>причем не все, и каждый раз разные.
S>Можно указать, что так не делал ?

CREATE TABLE a1
(
x int4 NOT NULL,
y varchar(20) NOT NULL,
z text NOT NULL,
CONSTRAINT a1_x_pkey PRIMARY KEY (x)
) WITH OIDS;
ALTER TABLE a1 OWNER TO postgres;

insert into a1 values (5, 'bbb', 'more than 100 symbols. more than 100
symbols. more than 100 symbols. more than 100 symbols. more than 100
symbols. more than 100 symbols. more than 100 symbols.');

CREATE OR REPLACE VIEW a1_view_0 AS
SELECT a1.z::character varying(100) AS z
FROM a1;

test=# select * from a1_view_0 where z like 'more%' ;
z
------------------------------------------------------------------------------------------------------
more than 100 symbols. more than 100 symbols. more than 100 symbols.
more than 100 symbols. more th
(1 запись)

как видите, всё работает.

или вы явно указываете тип в условии where при создании view ? типа create view... as select ... where z like 'xxx%'::varchar(100) ?

--
np: SOILWORK - Mercury Shadow

In response to

Browse pgsql-ru-general by date

  From Date Subject
Next Message Sergey Suleymanov 2006-02-01 09:53:50 Re: Кодиро
Previous Message Alexander M. Pravking 2006-01-31 11:16:36 Re: Кодиро