pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <pg@rbt.ca>
To: Markus Bertheau <twanger@bluetwanger.de>
Cc: PgSQL - SQL <pgsql-sql@postgresql.org>
Subject: Re: empty view, replace view, column type change?
Date: Thu, 23 Jun 2005 16:19:44 -0400
Message-ID: <1119557984.35441.95.camel@home> (raw)
In-Reply-To: <1119557009.7430.16.camel@localhost.localdomain>
References: <1119557009.7430.16.camel@localhost.localdomain>

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;

-- 




view thread (8+ messages)  latest in thread

Message-ID: <1119557984.35441.95.camel@home>
Permalink:  ../1119557984.35441.95.camel@home/
Also on:    postgresql.org/message-id/1119557984.35441.95.camel@home

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pg@rbt.ca, twanger@bluetwanger.de
  Subject: Re: empty view, replace view, column type change?
  In-Reply-To: <1119557984.35441.95.camel@home>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox