Thread: two buglets: createlang and pg_get_triggerdef

two buglets: createlang and pg_get_triggerdef

From
Alvaro Herrera Munoz
Date:
Hackers,

Two buglets:

The first one is in createlang, trying to create a language without
enough permission:

$ createlang -d alvherre plpgsql
createlang: language installation failed: ERROR:  c: permission denied

What's the "c" it's complaning about?


The second one is in pg_get_triggerdef():

alvherre=> create table test (foo int);
CREATE TABLE
alvherre=> create function foofun() returns trigger as 'select 1' language plpgsql;
CREATE FUNCTION
alvherre=> create trigger my_little_trigger before update on test execute procedure foofun();
CREATE TRIGGER
alvherre=> \d test    Table "public.test"Column |  Type   | Modifiers
--------+---------+-----------foo    | integer |
Triggers:   my_little^trigger BEFORE UPDATE ON test FOR EACH STATEMENT EXECUTE PROCEDURE foofun()

Note that the 9th character has been changed to "^".  I've seen the 9th
character change in all triggers here.  If I look at pg_trigger the name
is fine:

alvherre=> select tgname from pg_trigger where tgname='my_little_trigger';     tgname
-------------------my_little_trigger
(1 row)

This is not on latest CVS, but I haven't seem them reported nor fixed.

-- 
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"El sentido de las cosas no viene de las cosas, sino de
las inteligencias que las aplican a sus problemas diarios
en busca del progreso." (Ernesto Hern�ndez-Novich)


Re: two buglets: createlang and pg_get_triggerdef

From
Tom Lane
Date:
Alvaro Herrera Munoz <alvherre@dcc.uchile.cl> writes:
> $ createlang -d alvherre plpgsql
> createlang: language installation failed: ERROR:  c: permission denied
> What's the "c" it's complaning about?

The C procedural language, presumably.  This message is not up to our new
message standards I suppose ... it ought to mention what kind of object
"c" is.

> The second one is in pg_get_triggerdef():

> Triggers:
>     my_little^trigger BEFORE UPDATE ON test FOR EACH STATEMENT EXECUTE PROCEDURE foofun()

Bizarre.  It looks fine here.  What platform are you on?  Anyone else
see this?

> This is not on latest CVS, but I haven't seem them reported nor fixed.

Please pull latest CVS and do a full rebuild (make distclean etc).  If
you still see it after that, I'll pursue further.
        regards, tom lane


Re: two buglets: createlang and pg_get_triggerdef

From
Tom Lane
Date:
I said:
> Alvaro Herrera Munoz <alvherre@dcc.uchile.cl> writes:
>> $ createlang -d alvherre plpgsql
>> createlang: language installation failed: ERROR:  c: permission denied
>> What's the "c" it's complaning about?

> The C procedural language, presumably.  This message is not up to our new
> message standards I suppose ... it ought to mention what kind of object
> "c" is.

Okay, now it says

$ createlang plpgsql test
createlang: language installation failed: ERROR:  permission denied for language c
$ 

Let me know about the pg_get_triggerdef() thing ...
        regards, tom lane


Re: two buglets: createlang and pg_get_triggerdef

From
"Christopher Kings-Lynne"
Date:
> > Triggers:
> >     my_little^trigger BEFORE UPDATE ON test FOR EACH STATEMENT EXECUTE
PROCEDURE foofun()
>
> Bizarre.  It looks fine here.  What platform are you on?  Anyone else
> see this?

I actually had this while I was developing the feature.  I had thought I had
fixed it.  It's basically total weirdness in the behaviour of
appendStringInfo function IIRC.  Basically, I _think_ it was caused by
having two %s's in this:
      appendStringInfo(&buf, "CREATE %sTRIGGER %s ",                                        trigrec->tgisconstraint ?
"CONSTRAINT " : "",                                        quote_identifier(tgname));

I managed to get rid of the bug on my development machine, but it's
obviously cropped up again :(

Chris



Re: two buglets: createlang and pg_get_triggerdef

From
Tom Lane
Date:
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
>> Bizarre.  It looks fine here.  What platform are you on?  Anyone else
>> see this?

> I actually had this while I was developing the feature.

And what platform are *you* on?  It seems a really hard-to-believe
bug...
        regards, tom lane


Re: two buglets: createlang and pg_get_triggerdef

From
"Christopher Kings-Lynne"
Date:
> > I actually had this while I was developing the feature.
> 
> And what platform are *you* on?  It seems a really hard-to-believe
> bug...

FreeBSD/i386 I developed it on.

Chris



Re: two buglets: createlang and pg_get_triggerdef

From
"Christopher Kings-Lynne"
Date:
> > I actually had this while I was developing the feature.
>
> And what platform are *you* on?  It seems a really hard-to-believe
> bug...

This will actually be a must-fix for 7.4, as pg_dump uses it now to dump
triggers...

Chris



Re: two buglets: createlang and pg_get_triggerdef

From
Alvaro Herrera
Date:
On Thu, Jul 31, 2003 at 05:06:12PM -0400, Tom Lane wrote:
> Alvaro Herrera Munoz <alvherre@dcc.uchile.cl> writes:
> > $ createlang -d alvherre plpgsql
> > createlang: language installation failed: ERROR:  c: permission denied
> > What's the "c" it's complaning about?
> 
> The C procedural language, presumably.  This message is not up to our new
> message standards I suppose ... it ought to mention what kind of object
> "c" is.

Well, it's kind of unobvious anyway since I'm trying to create plpgsql,
why should I care for C?  Maybe createlang could detect the condition
and report a different error to the user.


> > The second one is in pg_get_triggerdef():
> 
> > Triggers:
> >     my_little^trigger BEFORE UPDATE ON test FOR EACH STATEMENT EXECUTE PROCEDURE foofun()
> 
> Please pull latest CVS and do a full rebuild (make distclean etc).  If
> you still see it after that, I'll pursue further.

Nope, I don't see it now.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Y dijo Dios: "Que sea Satanás, para que la gente no me culpe de todo a mí."
"Y que hayan abogados, para que la gente no culpe de todo a Satanás"