Skip site navigation (1) Skip section navigation (2)

BUG #4533: Plpgsql complex type failure

From: "Rod Taylor" <rod(dot)taylor(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4533: Plpgsql complex type failure
Date: 2008-11-16 16:30:05
Message-ID: 200811161630.mAGGU5lg015672@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      4533
Logged by:          Rod Taylor
Email address:      rod(dot)taylor(at)gmail(dot)com
PostgreSQL version: 8.3.5
Operating system:   FreeBSD 7.0 Stable
Description:        Plpgsql complex type failure
Details: 

The below script should be able to correctly set v_time to the complex type
timestamp_with_precision. It seems to take it as "timestamp with time zone"
instead creating interesting errors like this:

BEGIN
CREATE TYPE
CREATE FUNCTION
psql:/home/rbt/foo.sql:19: ERROR:  invalid input syntax for type timestamp
with time zone: "("2008-11-16 00:00:00-05",day)"
CONTEXT:  PL/pgSQL function "testfunc" line 4 at SQL statement
ROLLBACK


Note, the below continues to fail in the same way using
timestamp_with_precision%ROWTYPE.


BEGIN;

CREATE TYPE timestamp_with_precision AS
( timestamp timestamp with time zone
, timestamp_precision varchar
);

CREATE OR REPLACE FUNCTION testfunc() RETURNS boolean AS $FUNC$
DECLARE
  v_time timestamp_with_precision;
BEGIN
  SELECT (CURRENT_DATE, 'day')::timestamp_with_precision
    INTO v_time;

  RETURN true;
END;
$FUNC$ LANGUAGE plpgsql VOLATILE SECURITY DEFINER RETURNS NULL ON NULL
INPUT;

SELECT testfunc();


ROLLBACK;

Responses

pgsql-bugs by date

Next:From: PRIMEDate: 2008-11-17 14:37:43
Subject: BUG #4535: Foreign Key Constraints are not respected
Previous:From: Hiroshi SaitoDate: 2008-11-14 23:15:44
Subject: Re: BUG #4167: When generating UUID using UUID-OSSP module, UUIDs are not unique on Windows

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group