pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Clift <aa2@bigpond.net.au>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Cc: Jan Wieck <janwieck@Yahoo.com>
Subject: HELP: Scarey pl/pgsql problem
Date: Thu, 01 Feb 2001 13:50:55 +1100
Message-ID: <3A78CF0F.AD0F7A6F@bigpond.net.au> (raw)
References: <200101131404.JAA01424@jupiter.jw.home>

Hi all,

I'm having trouble with what MAY BE a bug in PL/PGSQL for PG 7.0.3 on
Linux (Mandrake Linux 7.2).

It appears pl/pgsql is munging values.  When I pass it a 'time' value,
the value is altered without my code touching it.  This is evidenced by
the stripped down function below :

CREATE FUNCTION which_block(time)
RETURNS time
AS 'DECLARE

/* Given a time, this function works out the name of the correct field
in the reservations table for it
 * Written by : Justin Clift
 * Date       : 1st February 2001
 * Version    : 1.00
 */
        hours   char(3);
        minutes char(2);
        result  char(5);
        tempres char(5);
        curnow  datetime;

        BEGIN

        RETURN $1;
        END;'
LANGUAGE 'plpgsql';


foobar=# select which_block(time '12:40:00');
 which_block
-------------
 12:39:00
(1 row)
 
foobar=# 

Having passed it the time value of '12:40:00', I am immediately
returning that value and it is no longer '12:40:00'.

Being over 1 month into using PostgreSQL 7.0.3 for a particular project,
this is scaring me as I'm now doubting the reliability of things.

Regards and best wishes,

Justin Clift
Database Administrator



view thread (3+ messages)  latest in thread

Message-ID: <3A78CF0F.AD0F7A6F@bigpond.net.au>
Permalink:  ../3A78CF0F.AD0F7A6F@bigpond.net.au/
Also on:    postgresql.org/message-id/3A78CF0F.AD0F7A6F@bigpond.net.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: aa2@bigpond.net.au, janwieck@Yahoo.com
  Subject: Re: HELP: Scarey pl/pgsql problem
  In-Reply-To: <3A78CF0F.AD0F7A6F@bigpond.net.au>
  References: <200101131404.JAA01424@jupiter.jw.home> <3A78CF0F.AD0F7A6F@bigpond.net.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox