Re: python patch - Mailing list pgsql-hackers

From Greg Copeland
Subject Re: python patch
Date
Msg-id 1029076612.25243.11.camel@mouse.copelandconsulting.net
Whole thread Raw
In response to Re: python patch  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Responses Re: python patch  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: python patch  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-hackers
Not a problem.  I would rather them be correct.

Worth noting that the first patch is what attempts to fix the long ->
int overflow issue.  The second patch attempts to resolve "attisdropped"
column use issues with the python scripts.  The third patch addresses
issues generated by the implicate to explicate use of "cascade".

I assume your reservations are only with the second patch and not the
first and third patches?

Greg


On Sun, 2002-08-11 at 04:43, Christopher Kings-Lynne wrote:
> I wouldn't apply this _just_ yet Bruce as I'm not certain all the changes
> are necessary...  I intend to look into it but I haven't had the time yet
> (sorry Greg!)
>
> Chris
>
>
> On Sun, 11 Aug 2002, Bruce Momjian wrote:
>
> >
> > Your patch has been added to the PostgreSQL unapplied patches list at:
> >
> >     http://candle.pha.pa.us/cgi-bin/pgpatches
> >
> > I will try to apply it within the next 48 hours.
> >
> > ---------------------------------------------------------------------------
> >
> >
> > Greg Copeland wrote:
> >
>  Checking application/pgp-signature: FAILURE
> > -- Start of PGP signed section.
> > > Well, that certainly appeared to be very straight forward.  pg.py and
> > > syscat.py scripts were both modified.  pg.py uses it to cache a list of
> > > pks (which is seemingly does for every db connection) and various
> > > attributes.  syscat uses it to walk the list of system tables and
> > > queries the various attributes from these tables.
> > >
> > > In both cases, it seemingly makes sense to apply what you've requested.
> > >
> > > Please find attached the quested patch below.
> > >
> > > Greg
> > >
> > >
> > > On Wed, 2002-08-07 at 22:16, Christopher Kings-Lynne wrote:
> > > > > I don't have a problem looking into it but I can't promise I can get it
> > > > > right.  My python skills are fairly good...my postgres internal skills
> > > > > are still sub-par IMO.
> > > > >
> > > > > From a cursory review, if attisdropped is true then the attribute/column
> > > > > should be ignored/skipped?! Seems pretty dang straight forward.
> > > >
> > > > Basically, yep.  Just grep the source code for pg_attribute most likely...
> > > >
> > > > I'm interested in knowing what it uses pg_attribute for as well...?
> > > >
> > > > Chris
> > > >
> > > >
> > > > ---------------------------(end of broadcast)---------------------------
> > > > TIP 3: if posting/reading through Usenet, please send an appropriate
> > > > subscribe-nomail command to majordomo@postgresql.org so that your
> > > > message can get through to the mailing list cleanly
> > >
> >
> > [ text/x-patch is unsupported, treating like TEXT/PLAIN ]
> >
> > > Index: pg.py
> > > ===================================================================
> > > RCS file: /projects/cvsroot/pgsql-server/src/interfaces/python/pg.py,v
> > > retrieving revision 1.9
> > > diff -u -r1.9 pg.py
> > > --- pg.py    2002/03/19 13:20:52    1.9
> > > +++ pg.py    2002/08/08 03:29:48
> > > @@ -69,7 +69,8 @@
> > >                          WHERE pg_class.oid = pg_attribute.attrelid AND
> > >                              pg_class.oid = pg_index.indrelid AND
> > >                              pg_index.indkey[0] = pg_attribute.attnum AND
> > > -                            pg_index.indisprimary = 't'""").getresult():
> > > +                            pg_index.indisprimary = 't' AND
> > > +                            pg_attribute.attisdropped = 'f'""").getresult():
> > >              self.__pkeys__[rel] = att
> > >
> > >      # wrap query for debugging
> > > @@ -111,7 +112,8 @@
> > >                      WHERE pg_class.relname = '%s' AND
> > >                          pg_attribute.attnum > 0 AND
> > >                          pg_attribute.attrelid = pg_class.oid AND
> > > -                        pg_attribute.atttypid = pg_type.oid"""
> > > +                        pg_attribute.atttypid = pg_type.oid AND
> > > +                        pg_attribute.attisdropped = 'f'"""
> > >
> > >          l = {}
> > >          for attname, typname in self.db.query(query % cl).getresult():
> > > Index: tutorial/syscat.py
> > > ===================================================================
> > > RCS file: /projects/cvsroot/pgsql-server/src/interfaces/python/tutorial/syscat.py,v
> > > retrieving revision 1.7
> > > diff -u -r1.7 syscat.py
> > > --- tutorial/syscat.py    2002/05/03 14:21:38    1.7
> > > +++ tutorial/syscat.py    2002/08/08 03:29:48
> > > @@ -37,7 +37,7 @@
> > >          FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a
> > >          WHERE i.indrelid = bc.oid AND i.indexrelid = bc.oid
> > >                  AND i.indkey[0] = a.attnum AND a.attrelid = bc.oid
> > > -                AND i.indproc = '0'::oid
> > > +                AND i.indproc = '0'::oid AND a.attisdropped = 'f'
> > >          ORDER BY class_name, index_name, attname""")
> > >      return result
> > >
> > > @@ -48,6 +48,7 @@
> > >          WHERE c.relkind = 'r' and c.relname !~ '^pg_'
> > >              AND c.relname !~ '^Inv' and a.attnum > 0
> > >              AND a.attrelid = c.oid and a.atttypid = t.oid
> > > +                        AND a.attisdropped = 'f'
> > >              ORDER BY relname, attname""")
> > >      return result
> > >
> > -- 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
> >
>


pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: pg_stat_reset() weirdness
Next
From: Florian Weimer
Date:
Subject: Re: [SECURITY] DoS attack on backend possible (was: Re: