Specifying Rowtypes
От | Curt Sampson |
---|---|
Тема | Specifying Rowtypes |
Дата | |
Msg-id | Pine.NEB.4.51.0301291440050.5881@angelic.cynic.net обсуждение исходный текст |
Ответы |
Re: Specifying Rowtypes
Re: Specifying Rowtypes Re: Specifying Rowtypes |
Список | pgsql-hackers |
So currently the only way to specify a row type is by using a table, right? E.g.: CREATE TABLE t2_retval (value1 int NOT NULL DEFAULT -1,value2 int NOT NULL,value3 int ); Are there plans to add another way of declaring this sort of thing so that I don't have to add a new table to my schema for every function that returns a rowtype? Second, it seems that there's still a problem with NULLs here: CREATE FUNCTION t2()RETURNS t2_retval AS ' DECLAREretval t2_retval%ROWTYPE; BEGINSELECT INTO retval null, null,null;RETURN retval; END ' LANGUAGE 'plpgsql'; This is returning a row that (to my mind) doesn't match the type of the table above, because it's returning null for non-nullable columns: cjs=> select coalesce(value1, -999), coalesce(value2, -999), cjs-> coalesce(value3, -999) from t2();case | case | case ------+------+-------999 | -999 | -999 (1 row) (You get the same result if you delete the SELECT INTO line above.) Am I misunderstanding something here, or is this a bug? cjs -- Curt Sampson <cjs@cynic.net> +81 90 7737 2974 http://www.netbsd.org Don't you know, in this new Dark Age, we're alllight. --XTC
В списке pgsql-hackers по дате отправления: