Re: Cannot declare record members NOT NULL

Поиск
Список
Период
Сортировка
От Cultural Sublimation
Тема Re: Cannot declare record members NOT NULL
Дата
Msg-id 334560.22089.qm@web63403.mail.re1.yahoo.com
обсуждение исходный текст
Ответ на Re: Cannot declare record members NOT NULL  ("Uwe C. Schroeder" <uwe@oss4u.com>)
Ответы Re: Cannot declare record members NOT NULL  (Cultural Sublimation <cultural_sublimation@yahoo.com>)
Re: Cannot declare record members NOT NULL  ("Uwe C. Schroeder" <uwe@oss4u.com>)
Список pgsql-general
> Why do you create an extra type for that?
> Just have your method return "movies"

Hi,

Thanks for the answer.  The simple example obfuscates the fact that in reality
the table has a few extra columns that are omitted from get_movies_t.
Therefore, I cannot return "movies".

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?

Thanks,
C.S.


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;
$$;





      ____________________________________________________________________________________
Shape Yahoo! in your own image.  Join our Network Research Panel today!
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 



В списке pgsql-general по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: problems with large table
Следующее
От: "Phoenix Kiula"
Дата:
Сообщение: Re: problems with large table