Обсуждение: WARNING: column "footype" has type "unknown"
On 7.4.6, is there any problem with defining one column of a view to be a string literal? For example ... $ psql -c "create view fooview as select 'bar' as footype" WARNING: column "footype" has type "unknown" DETAIL: Proceeding with relation creation anyway. CREATE VIEW Or is this warning just noise in this case? Ed
"Ed L." <pgsql@bluepolka.net> writes: > On 7.4.6, is there any problem with defining one column of a view to be a > string literal? For example ... > $ psql -c "create view fooview as select 'bar' as footype" > WARNING: column "footype" has type "unknown" > DETAIL: Proceeding with relation creation anyway. > CREATE VIEW > Or is this warning just noise in this case? Depending on what you expect to do with the view, you'd probably be better off casting the literal to some specific type, perhaps text or varchar. An example of what you won't be able to do: regression=# select distinct * from fooview; ERROR: failed to find conversion function from "unknown" to text I think there was some discussion in the past of forcing the view column to text type, but evidently nothing's been done about it yet. regards, tom lane
On Wednesday October 27 2004 5:24, Tom Lane wrote: > An example of what you won't be able to do: > > regression=# select distinct * from fooview; > ERROR: failed to find conversion function from "unknown" to text Is that 8.0 you're working against there? Here's my 7.4.6 installation: $ psql -c "create view fooview as select 'bar' as footype" WARNING: column "footype" has type "unknown" DETAIL: Proceeding with relation creation anyway. CREATE VIEW $ psql -c "select * from fooview" footype --------- bar (1 row)
On Wednesday October 27 2004 5:34, Ed L. wrote: > On Wednesday October 27 2004 5:24, Tom Lane wrote: > > An example of what you won't be able to do: > > > > regression=# select distinct * from fooview; > > ERROR: failed to find conversion function from "unknown" to text > > Is that 8.0 you're working against there? Here's my 7.4.6 installation: > > $ psql -c "select * from fooview" Ah, sorry. Just noticed the "distinct". Thanks. Ed