BUG #3328: initialization complex types with domain column

From: "Sergey Morgalev" <sergo(at)virtonomica(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3328: initialization complex types with domain column
Date: 2007-05-31 13:27:45
Message-ID: 200705311327.l4VDRjWC044319@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3328
Logged by: Sergey Morgalev
Email address: sergo(at)virtonomica(dot)ru
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.

Browse pgsql-bugs by date

  From Date Subject
Next Message Thekkayil Joy Thomas 2007-06-01 05:47:23 BUG #3329: Issue with INSERT INTO for japanese katakana characters.
Previous Message Johndhihj 2007-05-31 12:41:11 BUG #3327: Hi great site great work thank you!