bug in contrib/adddepend

Started by Christopher Kings-Lynneabout 23 years ago8 messageshackers
Jump to latest
#1Christopher Kings-Lynne
chriskl@familyhealth.com.au

Hi,

I just noticed a bug in adddepend:

The below commands will upgrade the foreign key style. Shall I execute
them?

DROP TRIGGER "RI_ConstraintTrigger_1105102" ON news_authors;
DROP TRIGGER "RI_ConstraintTrigger_1105103" ON news_authors;
DROP TRIGGER "RI_ConstraintTrigger_1105118" ON news_articles;

ALTER TABLE news_articles ADD CONSTRAINT "<unnamed>" FOREIGN
KEY (author)
REFERENCES news_authors(id) MATCH SIMPLE ON UPDATE NO
ACTION ON DELETE NO ACTION;

See how it's HTMLised the foreign key name? I cannot find how $keyname in
the code is being html escaped. Perhaps it's some weird taint mode thing?

Rod - you got any ideas?

Chris

#2Rod Taylor
rbt@rbt.ca
In reply to: Christopher Kings-Lynne (#1)
Re: bug in contrib/adddepend

On Thu, 2003-02-20 at 22:08, Christopher Kings-Lynne wrote:

Hi,

I just noticed a bug in adddepend:

The below commands will upgrade the foreign key style. Shall I execute
them?

DROP TRIGGER "RI_ConstraintTrigger_1105102" ON news_authors;
DROP TRIGGER "RI_ConstraintTrigger_1105103" ON news_authors;
DROP TRIGGER "RI_ConstraintTrigger_1105118" ON news_articles;

ALTER TABLE news_articles ADD CONSTRAINT "<unnamed>" FOREIGN
KEY (author)
REFERENCES news_authors(id) MATCH SIMPLE ON UPDATE NO
ACTION ON DELETE NO ACTION;

See how it's HTMLised the foreign key name? I cannot find how $keyname in
the code is being html escaped. Perhaps it's some weird taint mode thing?

Not to mention when it's <unnamed>, the code is setup to ignore the
constraint name entirely (line 267).

There isn't anything that changes the value of $keyname after it's
pulled from the DBI drivers. What version of DBI::Pg are you using?

Last time I used it was with DBI::Pg v1.13.

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

#3Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Rod Taylor (#2)
Re: bug in contrib/adddepend

See how it's HTMLised the foreign key name? I cannot find how $keyname in
the code is being html escaped. Perhaps it's some weird taint mode thing?

Not to mention when it's <unnamed>, the code is setup to ignore the
constraint name entirely (line 267).

I worked around it by checking to see if it equalled '&lt;unnamed&gt;' as
well as '<unnamed>'. I also have heaps of RI triggers left over after the
addepend run, so I'll investigate why adddepend doesn't pick them up...

There isn't anything that changes the value of $keyname after it's
pulled from the DBI drivers. What version of DBI::Pg are you using?

Last time I used it was with DBI::Pg v1.13.

I'm using:

p5-DBD-Pg-1.21 Provides access to PostgreSQL databases through the
p5-DBI-1.28 The perl5 Database Interface. Required for DBD::*

Chris

#4Rod Taylor
rbt@rbt.ca
In reply to: Christopher Kings-Lynne (#3)
Re: bug in contrib/adddepend

I worked around it by checking to see if it equalled '&lt;unnamed&gt;' as
well as '<unnamed>'. I also have heaps of RI triggers left over after the
addepend run, so I'll investigate why adddepend doesn't pick them up...

Took a quick look, and I don't see anything in DBD-Pg that would do this
type of conversion.

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

#5Bruce Momjian
bruce@momjian.us
In reply to: Rod Taylor (#4)
Re: bug in contrib/adddepend

Was this resolved. Christopher, do you have a reproducible case?

---------------------------------------------------------------------------

Rod Taylor wrote:
-- Start of PGP signed section.

I worked around it by checking to see if it equalled '&lt;unnamed&gt;' as
well as '<unnamed>'. I also have heaps of RI triggers left over after the
addepend run, so I'll investigate why adddepend doesn't pick them up...

Took a quick look, and I don't see anything in DBD-Pg that would do this
type of conversion.

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

-- End of PGP section, PGP failed!

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#6Rod Taylor
rbt@rbt.ca
In reply to: Bruce Momjian (#5)
Re: bug in contrib/adddepend

On Thu, 2003-03-06 at 09:58, Bruce Momjian wrote:

Was this resolved. Christopher, do you have a reproducible case?

I've not been able to reproduce it, nor have I had a similar complaint.

I think it's a system configuration issue or somekind. Otherwise there
would have been many many more complaints, as <unknown> is a rather
common name for constraints :).

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

#7Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Bruce Momjian (#5)
Re: bug in contrib/adddepend

Was this resolved. Christopher, do you have a reproducible case?

It wasn't resolved, in fact I'd forgotten about it :)

I do have a reproducible case (our live server), however it seems like it's
basically a case of an invalid set of triggers. I really need to manually
remove some of the triggers. eg. They're supporting one side of the foreign
key, but not the other, etc...

Chris

#8Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Bruce Momjian (#5)
Re: bug in contrib/adddepend

Was this resolved. Christopher, do you have a reproducible case?

Oh sorry, I answered the wrong question!

Yes, I resolved it by reinstalling my DBD perl stuff.

I still have the problem of left over constraint triggers, but they do look
like they're broken, so it's not an adddepend problem...

Chris