BUG #1604: Composite types, triggers, and INET_CLIENT_ADDR() function

From: "Chris Trawick" <ctrawick(at)cultured(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1604: Composite types, triggers, and INET_CLIENT_ADDR() function
Date: 2005-04-17 02:29:04
Message-ID: 20050417022904.8912FF0B22@svr2.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1604
Logged by: Chris Trawick
Email address: ctrawick(at)cultured(dot)net
PostgreSQL version: 8.0.1
Operating system: i686-pc-linux-gnu, compiled by GCC i686-pc-linux-gnu-gcc
(GCC) 3.3.5 (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)
Description: Composite types, triggers, and INET_CLIENT_ADDR()
function
Details:

I'm encountering an error when using a plpgsql insert trigger to
automatically log the client connection information using
INET_CLIENT_ADDR(). No changes from default install configuration. Fresh
PG_DATA install.

Here's my test case:

CREATE TYPE SocketAddress AS(
addr INET,
port INT
);

CREATE TABLE BugTable(
intValue int NOT NULL,
clientAddr SocketAddress NOT NULL
);

CREATE FUNCTION
BugTable_setClientAddr()
RETURNS TRIGGER AS $$
BEGIN
NEW.clientAddr := (INET_CLIENT_ADDR(),INET_CLIENT_PORT());
RETURN NEW;
END;
$$ LANGUAGE plpgsql;

CREATE TRIGGER BugTable_onInsert_setClientAddr
BEFORE INSERT
ON BugTable
FOR EACH ROW EXECUTE PROCEDURE BugTable_setClientAddr();

$ psql -h localhost
ctrawick=# SELECT version();
version
----------------------------------------------------------------------------
-----------------------------------------------------------------
PostgreSQL 8.0.1 on i686-pc-linux-gnu, compiled by GCC
i686-pc-linux-gnu-gcc (GCC) 3.3.5 (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3,
pie-8.7.7.1)
(1 row)

ctrawick=# \set VERBOSITY verbose
ctrawick=# INSERT INTO BugTable(intValue) VALUES(0);
ERROR: XX000: could not find block containing chunk 0x83664e8
CONTEXT: PL/pgSQL function "bugtable_setclientaddr" line 2 at assignment
LOCATION: AllocSetFree, aset.c:786

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Guilherme Paiva 2005-04-17 21:04:32 Lib use.
Previous Message Tom Lane 2005-04-17 00:50:10 Re: BUG #1600: Interrupt routine causes libPQ call to fail w/o error