Re: Cannot declare record members NOT NULL - Mailing list pgsql-general

From Cultural Sublimation
Subject Re: Cannot declare record members NOT NULL
Date
Msg-id 64275.95611.qm@web63409.mail.re1.yahoo.com
Whole thread Raw
In response to Re: Cannot declare record members NOT NULL  (Cultural Sublimation <cultural_sublimation@yahoo.com>)
Responses Re: Cannot declare record members NOT NULL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi again,

> However, your answer did give me an idea:  instead of declaring
> "get_movies_t" as a record, I declare it as dummy table, and return
> that (see code at the end).
> This works, though it is *very* ugly.  Any other ideas?

My apologies, but it turns out that this solution doesn't work after
all. Postgresql still insists that movie_id and movie_name are NULL,
though I explicitly declared them as NOT NULL:

> CREATE TABLE get_movies_t
> (
> movie_id                int4 NOT NULL,
> movie_name              text NOT NULL
> );
>
> CREATE FUNCTION get_movies ()
> RETURNS SETOF get_movies_t
> LANGUAGE sql STABLE
> AS
> $$
> SELECT movie_id, movie_name FROM movies;
> $$;


This bug seems to obvious to have been generally missed.  I have to
wonder if it is not a bug in my particular build of Postgresql -- I am
running version 8.2.4 straight from the Ubuntu repositories (package
version 8.2.4-1~edgy1).

Could someone else try the code and check if Postgresql returns
the correct type?

Thanks,
C.S.



      ____________________________________________________________________________________
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: problems with large table
Next
From: "Uwe C. Schroeder"
Date:
Subject: Re: Cannot declare record members NOT NULL