Passing a row - Mailing list pgsql-general

From Terry Lee Tucker
Subject Passing a row
Date
Msg-id 200403261026.16099.terry@esc1.com
Whole thread Raw
Responses Re: Passing a row
List pgsql-general
PostgreSQL Version:
PostgreSQL 7.3.4 on i386-redhat-linux-gnu, compiled by GCC
i386-redhat-linux-gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

I'm trying to pass a row into a function and cannot get it to work. The code
doing the calling is (logs_preupd_func):
DECLARE
    test    RECORD;
...
...

    SELECT INTO test * FROM logs WHERE order_num = new.order_num;
    PERFORM valid_event_time (test);

The defintition for valid_event_time ():

CREATE OR REPLACE FUNCTION valid_event_time (logs)
    RETURNS text AS '
.
.
.
I get the following error:
WARNING:  Error occurred while executing PL/pgSQL function logs_preupd_func
WARNING:  line 131 at assignment
ERROR:  Attribute "test" not found

This example in the docs indicates that this can be done as in:
CREATE FUNCTION use_two_tables(tablename) RETURNS TEXT AS '
DECLARE
    in_t ALIAS FOR $1;
    use_t table2name%ROWTYPE;
BEGIN
    SELECT * INTO use_t FROM table2name WHERE ... ;
    RETURN in_t.f1 || use_t.f3 || in_t.f5 || use_t.f7;
END;
' LANGUAGE 'plpgsql';

Can anybody show me the error of my ways?

Thanks...
--
 Work: 1-336-372-6812
 Cell: 1-336-363-4719
email: terry@esc1.com

pgsql-general by date:

Previous
From: CoL
Date:
Subject: Re: case statement as inline function?
Next
From: Wes Palmer
Date:
Subject: Re: Solaris ecpg program doesn't work - pulling my hair