Skip site navigation (1) Skip section navigation (2)

Re: minor view creation weirdness

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: minor view creation weirdness
Date: 2003-10-03 17:26:07
Message-ID: 28239.1065201967@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Greg Stark <gsstark(at)mit(dot)edu> writes:
> Uhm, doesn't the spec have anything to say about this? 
> I mean, the view sure looks like standard SQL on its face.

Well, you might read the spec as requiring the view column to have
datatype CHAR(n) where n is the length of the unknown literal.
I see in SQL92:

         9) The data type of a <character string literal> is fixed-length
            character string. The length of a <character string literal>
            is the number of <character representation>s that it contains.
            ...
            Note: <character string literal>s are allowed to be zero-length
            strings (i.e., to contain no characters) even though it is
            not permitted to declare a <data type> that is CHARACTER with
            <length> zero.

The NOTE would appear to imply that

	CREATE VIEW v AS SELECT '';

is illegal, which is not a conclusion I care to follow blindly.  In any
case, in Postgres I would think we would want to take the type as "text"
not "CHAR(n)", spec or no spec.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2003-10-03 18:32:56
Subject: initdb
Previous:From: Gottfried F. ZojerDate: 2003-10-03 17:22:39
Subject: Re: Question regarding coopting Database Engine

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group