ordbms - postgresql errata

Started by Jeff MacDonaldover 25 years ago2 messages
#1Jeff MacDonald
jeff@pgsql.com

i just found a (few) caveat already..

1:

bignose=# create table people(
bignose(# name varchar(64),
bignose(# age int8,
bignose(# sin int4,
bignose(# id serial);

bignose=# create table soldier(
bignose(# rank varchar(32),
bignose(# post varchar(32)) inherits (people);

bignose=# alter table people add column gender int2;
ALTER
bignose=# \d soldier
Table "soldier"
Attribute | Type | Modifier
-----------+-------------+-------------------------------------------------
name | varchar(64) |
age | bigint |
sin | integer |
id | integer | not null default nextval('people_id_seq'::text)
rank | varchar(32) |
post | varchar(32) |

now you can see that the attribute was added to the super class
but the sub class didn't inhereit..

----------- NEXT -------------

bignose=# insert into soldier (name,age,sin) values
bignose-# ('fred',19,12321);

bignose=# select p.* from people* p;
name | age | sin | id | gender
------+-----+-------+----+--------
fred | 19 | 12321 | 1 | -16968

i didn't specify a gender, but it put in a "randomish" value..
shouldn't it have just left this untouched ?

Jeff MacDonald,

-----------------------------------------------------
PostgreSQL Inc | Hub.Org Networking Services
jeff@pgsql.com | jeff@hub.org
www.pgsql.com | www.hub.org
1-902-542-0713 | 1-902-542-3657
-----------------------------------------------------
Fascimile : 1 902 542 5386
IRC Nick : bignose

#2Jeff MacDonald
jeff@pgsql.com
In reply to: Jeff MacDonald (#1)
Re: ordbms - postgresql errata

it would appear my first mail didn't go thru

the basic gist was,

can anyone point out any caveats/pitfalls to the
postgresql inheritance functions..

On Tue, 19 Sep 2000, Jeff MacDonald wrote:

i just found a (few) caveat already..

1:

bignose=# create table people(
bignose(# name varchar(64),
bignose(# age int8,
bignose(# sin int4,
bignose(# id serial);

bignose=# create table soldier(
bignose(# rank varchar(32),
bignose(# post varchar(32)) inherits (people);

bignose=# alter table people add column gender int2;
ALTER
bignose=# \d soldier
Table "soldier"
Attribute | Type | Modifier
-----------+-------------+-------------------------------------------------
name | varchar(64) |
age | bigint |
sin | integer |
id | integer | not null default nextval('people_id_seq'::text)
rank | varchar(32) |
post | varchar(32) |

now you can see that the attribute was added to the super class
but the sub class didn't inhereit..

----------- NEXT -------------

bignose=# insert into soldier (name,age,sin) values
bignose-# ('fred',19,12321);

bignose=# select p.* from people* p;
name | age | sin | id | gender
------+-----+-------+----+--------
fred | 19 | 12321 | 1 | -16968

i didn't specify a gender, but it put in a "randomish" value..
shouldn't it have just left this untouched ?

Jeff MacDonald,

-----------------------------------------------------
PostgreSQL Inc | Hub.Org Networking Services
jeff@pgsql.com | jeff@hub.org
www.pgsql.com | www.hub.org
1-902-542-0713 | 1-902-542-3657
-----------------------------------------------------
Fascimile : 1 902 542 5386
IRC Nick : bignose

Jeff MacDonald,

-----------------------------------------------------
PostgreSQL Inc | Hub.Org Networking Services
jeff@pgsql.com | jeff@hub.org
www.pgsql.com | www.hub.org
1-902-542-0713 | 1-902-542-3657
-----------------------------------------------------
Fascimile : 1 902 542 5386
IRC Nick : bignose