Unix Technical Forum

Get rid of system attributes in pg_attribute?

This is a discussion on Get rid of system attributes in pg_attribute? within the pgsql Hackers forums, part of the PostgreSQL category; --> I'm wondering how useful it is to store explicit representations of the system attributes in pg_attribute. We could very ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 03:46 AM
Tom Lane
 
Posts: n/a
Default Get rid of system attributes in pg_attribute?

I'm wondering how useful it is to store explicit representations of the
system attributes in pg_attribute. We could very easily hard-wire those
things instead, which would make for a large reduction in the number of
entries in pg_attribute. (In the current regression database nearly
half of the rows have attnum < 0.) I think the impact on the backend
would be pretty minimal, but I'm wondering if removing these entries
would be likely to break any client-side code. Does anyone know of
client code that actually pays attention to pg_attribute rows with
negative attnums?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 03:48 AM
Christopher Kings-Lynne
 
Posts: n/a
Default Re: Get rid of system attributes in pg_attribute?

> I'm wondering how useful it is to store explicit representations of the
> system attributes in pg_attribute. We could very easily hard-wire those
> things instead, which would make for a large reduction in the number of
> entries in pg_attribute. (In the current regression database nearly
> half of the rows have attnum < 0.) I think the impact on the backend
> would be pretty minimal, but I'm wondering if removing these entries
> would be likely to break any client-side code. Does anyone know of
> client code that actually pays attention to pg_attribute rows with
> negative attnums?


Well, apart from a "attnum > 0" clause in phpPgAdmin, I don't think so...

Chris

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 03:49 AM
Robert Treat
 
Posts: n/a
Default Re: Get rid of system attributes in pg_attribute?

On Monday 21 February 2005 04:23, Christopher Kings-Lynne wrote:
> > I'm wondering how useful it is to store explicit representations of the
> > system attributes in pg_attribute. We could very easily hard-wire those
> > things instead, which would make for a large reduction in the number of
> > entries in pg_attribute. (In the current regression database nearly
> > half of the rows have attnum < 0.) I think the impact on the backend
> > would be pretty minimal, but I'm wondering if removing these entries
> > would be likely to break any client-side code. Does anyone know of
> > client code that actually pays attention to pg_attribute rows with
> > negative attnums?

>
> Well, apart from a "attnum > 0" clause in phpPgAdmin, I don't think so...
>


Well, the corner case would be for those times when we use oid for updating
specific rows in a table, if a user creates there own oid column then you
could have trouble. Actually we already have a safegaurd for this in
phppgadmin so we wont cause mistakes, it's just that those updates probably
won't work... others might not have been so thorough though.

--
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-11-2008, 03:49 AM
Tom Lane
 
Posts: n/a
Default Re: Get rid of system attributes in pg_attribute?

Robert Treat <xzilla@users.sourceforge.net> writes:
>>> Does anyone know of
>>> client code that actually pays attention to pg_attribute rows with
>>> negative attnums?


> Well, the corner case would be for those times when we use oid for updating
> specific rows in a table, if a user creates there own oid column then you
> could have trouble. Actually we already have a safegaurd for this in
> phppgadmin so we wont cause mistakes, it's just that those updates probably
> won't work... others might not have been so thorough though.


Anyone who's not checking that has been at risk ever since we invented
WITHOUT OIDS:

regression=# create table foo (oid text);
ERROR: column name "oid" conflicts with a system column name
regression=# create table foo (oid text) without oids;
CREATE TABLE

Probably ctid is the more interesting case; I'm pretty sure ODBC relies
on ctid as a short-term-unique row identifier.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-11-2008, 03:49 AM
Robert Treat
 
Posts: n/a
Default Re: Get rid of system attributes in pg_attribute?

On Tuesday 22 February 2005 10:32, Tom Lane wrote:
> Robert Treat <xzilla@users.sourceforge.net> writes:
> >>> Does anyone know of
> >>> client code that actually pays attention to pg_attribute rows with
> >>> negative attnums?

> >
> > Well, the corner case would be for those times when we use oid for
> > updating specific rows in a table, if a user creates there own oid column
> > then you could have trouble. Actually we already have a safegaurd for
> > this in phppgadmin so we wont cause mistakes, it's just that those
> > updates probably won't work... others might not have been so thorough
> > though.

>
> Anyone who's not checking that has been at risk ever since we invented
> WITHOUT OIDS:
>
> regression=# create table foo (oid text);
> ERROR: column name "oid" conflicts with a system column name
> regression=# create table foo (oid text) without oids;
> CREATE TABLE
>


Actually I was thinking more the case where someone creates their own column
names oid where they have no intention of those values being unique. If you
weren't already checking for duplicate oid's you could be in for trouble.

> Probably ctid is the more interesting case; I'm pretty sure ODBC relies
> on ctid as a short-term-unique row identifier.
>


Yeah... how many utility tools out there reference system columns explicitly?
I think we need a scheme for allowing them to keep working even with user
defined columns of the same name.

--
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-11-2008, 03:49 AM
Tom Lane
 
Posts: n/a
Default Re: Get rid of system attributes in pg_attribute?

Robert Treat <xzilla@users.sourceforge.net> writes:
> On Tuesday 22 February 2005 10:32, Tom Lane wrote:
>> Probably ctid is the more interesting case; I'm pretty sure ODBC relies
>> on ctid as a short-term-unique row identifier.


> Yeah... how many utility tools out there reference system columns explicitly?
> I think we need a scheme for allowing them to keep working even with user
> defined columns of the same name.


Well, that probably knocks out my thought that we could stop reserving
the system column names (at least ctid and xmin, which are the two that
actually seem useful to ordinary clients, need to stay reserved). But
it still seems like we don't have to represent these columns explicitly
in pg_attribute.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-11-2008, 03:49 AM
Andreas Pflug
 
Posts: n/a
Default Re: Get rid of system attributes in pg_attribute?

Tom Lane wrote:

> Well, that probably knocks out my thought that we could stop reserving
> the system column names (at least ctid and xmin, which are the two that
> actually seem useful to ordinary clients, need to stay reserved). But
> it still seems like we don't have to represent these columns explicitly
> in pg_attribute.


Hm, technically you might be right. Still, I like pgAdmin3 to show that
columns (when "show system objects" is enabled) for teaching purposes,
so users/newbies browsing the objects will learn "hey, there are some
reserved columns, they could have some meaning". I'd be not too excited
about emulating system column pg_attribute entries...


Regards,
Andreas

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-11-2008, 03:49 AM
Tom Lane
 
Posts: n/a
Default Re: Get rid of system attributes in pg_attribute?

Andreas Pflug <pgadmin@pse-consulting.de> writes:
> Tom Lane wrote:
>> it still seems like we don't have to represent these columns explicitly
>> in pg_attribute.


> Hm, technically you might be right. Still, I like pgAdmin3 to show that
> columns (when "show system objects" is enabled) for teaching purposes,
> so users/newbies browsing the objects will learn "hey, there are some
> reserved columns, they could have some meaning".


Not unreasonable, but is it worth a factor of 2 in the size of
pg_attribute?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-11-2008, 03:49 AM
Andreas Pflug
 
Posts: n/a
Default Re: Get rid of system attributes in pg_attribute?

Tom Lane wrote:
> Andreas Pflug <pgadmin@pse-consulting.de> writes:
>
>>Tom Lane wrote:
>>
>>>it still seems like we don't have to represent these columns explicitly
>>>in pg_attribute.

>
>
>>Hm, technically you might be right. Still, I like pgAdmin3 to show that
>>columns (when "show system objects" is enabled) for teaching purposes,
>>so users/newbies browsing the objects will learn "hey, there are some
>>reserved columns, they could have some meaning".

>
>
> Not unreasonable, but is it worth a factor of 2 in the size of
> pg_attribute?


Do we need to save space? On a DB with quite some tables I have
pg_attribute size=7.5MB, pg_class size 5.8MB (13166 pg_attribute rows
total, 5865 system columns, most tables without oids). This doesn't seem
unacceptable big to me.

Regards,
Andreas

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:07 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com