Re: empty view, replace view, column type change?

From: Rod Taylor <pg(at)rbt(dot)ca>
To: Markus Bertheau <twanger(at)bluetwanger(dot)de>
Cc: PgSQL - SQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: empty view, replace view, column type change?
Date: 2005-06-23 20:19:44
Message-ID: 1119557984.35441.95.camel@home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 2005-06-23 at 22:03 +0200, Markus Bertheau wrote:
> Hi,
>
> it seems to me that the following should work but it fails:
>
> CREATE VIEW co AS SELECT LOCALTIMESTAMP::TIMESTAMP AS ov WHERE FALSE;
> CREATE TABLE link (ov TIMESTAMP);
> CREATE OR REPLACE VIEW co AS SELECT ov FROM link;

The data types are different, as one has the timestamp to (6) decimal
places after seconds.

development=# CREATE VIEW co AS SELECT LOCALTIMESTAMP::TIMESTAMP AS ov
WHERE FALSE;
CREATE VIEW
development=# CREATE TABLE link (ov TIMESTAMP);
CREATE TABLE
development=# CREATE OR REPLACE VIEW cod AS SELECT ov FROM link;
CREATE VIEW
development=# \d co
View "rbt.co"
Column | Type | Modifiers
--------+--------------------------------+-----------
ov | timestamp(6) without time zone |
View definition:
SELECT 'now'::text::timestamp(6) without time zone AS ov
WHERE false;

development=# \d cod
View "rbt.cod"
Column | Type | Modifiers
--------+-----------------------------+-----------
ov | timestamp without time zone |
View definition:
SELECT link.ov
FROM link;

--

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Markus Bertheau 2005-06-23 20:21:58 Re: empty view, replace view, column type change?
Previous Message Russell Simpkins 2005-06-23 20:03:45 Re: Grouping Too Closely