Bear Giles <bgiles@coyotesong.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