Log Message: ----------- All composite types are nullable in SQL/PSM and default value is NULL. PostgreSQL doesn't support objects constructor, so value has to be inicialised with row constructor. CREATE TYPE xx AS (a integer, b integer); CREATE OR REPLACE FUNCTION fxx() RETURNS void AS $$ BEGIN DECLARE a xx; IF a IS NULL THEN PRINT 'is null'; END IF; SET a = row(); SET a.a = 10, a.b = 20; PRINT a; SET a = NULL; PRINT a; END; $$ LANGUAGE plpgpsm; SELECT fxx(); NOTICE: is null NOTICE: (10,20) NOTICE: <NULL> fxx ----- (1 row) DROP FUNCTION fxx(); -- cannot use empty composite value CREATE OR REPLACE FUNCTION fxx() RETURNS void AS $$ BEGIN DECLARE a xx; PRINT a.a; END; $$ LANGUAGE plpgpsm; SELECT fxx(); ERROR: variable "a" is not assigned yet CONTEXT: PL/pgPSM function "fxx()" line 4 at PRINT DROP FUNCTION fxx(); DROP TYPE xx; Modified Files: -------------- plpgpsm/src: pl_comp.c (r1.26 -> r1.27) (http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/plpsm/plpgpsm/src/pl_comp.c.diff?r1=1.26&r2=1.27) pl_exec.c (r1.62 -> r1.63) (http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/plpsm/plpgpsm/src/pl_exec.c.diff?r1=1.62&r2=1.63) plpgpsm.h (r1.48 -> r1.49) (http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/plpsm/plpgpsm/src/plpgpsm.h.diff?r1=1.48&r2=1.49) plpgpsm/src/expected: plpgpsm.out (r1.22 -> r1.23) (http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/plpsm/plpgpsm/src/expected/plpgpsm.out.diff?r1=1.22&r2=1.23) plpgpsm/src/sql: plpgpsm.sql (r1.19 -> r1.20) (http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/plpsm/plpgpsm/src/sql/plpgpsm.sql.diff?r1=1.19&r2=1.20)
pgsql-committers by date:
Соглашаюсь с условиями обработки персональных данных