The following bug has been logged online: Bug reference: 3328 Logged by: Sergey Morgalev Email address: [EMAIL PROTECTED] PostgreSQL version: 8.2.4 Operating system: windows xp, free bsd Description: initialization complex types with domain column Details:
Hello. When user defined complex type with user defined DOMAIN with NOT NULL AND DEFAULT attrubute, postgres can't initialize variable in DECLARE section of PROCEDURE for example: -- create some DOMAIN CREATE DOMAIN my_domain AS numeric DEFAULT 0 NOT NULL; -- create complex type CREATE TYPE t_my_type AS ( int id, name vachar, value my_domain ) PostgreSQL 8.2.4 does not allow the declare variable with type 't_my_type' in a FUNCTION CREATE OR REPLACE FUNCTION m_function() RETURNS SETOF t_my_type AS $$ DECLARE _my_var t_my_type; ------- skipped ------ ERROR: domain my_domain does not allow null values CONTEXT: PL/pgSQL function "my_function" line 4 at block variables initialization Ok. will declare the '_my_var' variable with type 'RECORD' and initialize record in the FUNCTION body. Postgres will cast the record var to t_my_type and allow return SETOF. But. When FUNCTION accept argument with complex type, it is not possible. PostgreSQL can't cast record to user defined type. It is not possible use complex types with such domains in procedures. In previous version - 8.2.1 it's worked normaly. ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings