Re: inserting user defined types through a rule?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bear Giles <bgiles(at)coyotesong(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: inserting user defined types through a rule?
Date: 2002-04-02 02:58:37
Message-ID: 20105.1017716317@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bear Giles <bgiles(at)coyotesong(dot)com> writes:
> I recently discovered a problem inserting a user-defined type when
> going through a rule. ...

> The problem is that I can insert literal text:
> create table t ( cert x509 );
> insert into t values ('---- BEGIN CERTIFICATE ---- ....');
> but when I try the same with cert_insert it's clear that "new.cert"
> isn't getting initialized properly. (It works fine when the cert is
> already in the database.) Trying to explicitly cast the literal to
> as part of the query doesn't help - it seems that the rule just rewrites
> the query and the cast is getting lost.

This seems like a bug, but I don't have much hope of being able to find
it without a test case to step through. Could you boil things down to a
reproducible test case?

FWIW, it seems unlikely that the issue is your user-defined type per se;
the rule rewriter mechanisms are quite type-ignorant. You may be able
to develop a test case that doesn't use your own type at all.

> Any ideas? Is this something addressed in 7.2?

Can't tell at this point. What version are you using, anyway?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bear Giles 2002-04-02 03:37:34 Re: inserting user defined types through a rule?
Previous Message Nicolas Bazin 2002-04-02 00:41:51 please apply patch