pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedconfusing inheritance
2+ messages / 2 participants
[nested] [flat]
* confusing inheritance
@ 2002-03-04 11:46 Andreas F. <maps.on@gmx.net>
2002-03-07 15:49 ` Re: confusing inheritance Stephan Szabo <sszabo@megazone23.bigpanda.com>
0 siblings, 1 reply; 2+ messages in thread
From: Andreas F. @ 2002-03-04 11:46 UTC (permalink / raw)
To: pgsql-sql
I'm trying to get going with this objekt oriented concept but managed to
get confused right from the start.
Basically I know what it's all about with OO from programming languages
but look:
I started pgAdmin and entered something like
TABLE myObjects (
ObjectID int4 PRIMARY KEY,
createdOn timestamp,
createdByUserID int4
)
then
TABLE myTerminatedObjects (
validFrom timestamp,
validUntil timestamp
) INHERITS myObjects
I inserted an object with ObjectID = 0 into myOjects.
Then I inserted a record in myTerminatedObjects again with ObjectID=0
since I supposed that myTerm... only inherited the structure of myObjects.
As expected myTerm... had one record.
But myObjects held 2 records both with 0 in the ObjectID column, which I
thought to be impossible because it is the primary key of myObjects.
Obviously myTerminatedObjects stores it's values of inherited fields in
the tablespace of myObjects breaking myObjects integrity without
PostgreSQL complainig about.
Am I right ?
And myTerm... inherits the field "ObjectID" but not in the function as
primary key so it has no key at all ?
At least MS-Access 2K told me so.
May someone give me a pointer to whats going on, please ?
... Andreas
System:
Win 2K
PostgreSQL 7.2.2 as service
Access 2K as client
pgAdminII 1.2.0 as client
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: confusing inheritance
2002-03-04 11:46 confusing inheritance Andreas F. <maps.on@gmx.net>
@ 2002-03-07 15:49 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
0 siblings, 0 replies; 2+ messages in thread
From: Stephan Szabo @ 2002-03-07 15:49 UTC (permalink / raw)
To: Andreas F. <maps.on@gmx.net>; +Cc: pgsql-sql
On Mon, 4 Mar 2002, Andreas F. wrote:
> I started pgAdmin and entered something like
>
> TABLE myObjects (
> ObjectID int4 PRIMARY KEY,
> createdOn timestamp,
> createdByUserID int4
> )
>
> then
>
> TABLE myTerminatedObjects (
> validFrom timestamp,
> validUntil timestamp
> ) INHERITS myObjects
>
> Obviously myTerminatedObjects stores it's values of inherited fields in
> the tablespace of myObjects breaking myObjects integrity without
> PostgreSQL complainig about.
> Am I right ?
>
> And myTerm... inherits the field "ObjectID" but not in the function as
> primary key so it has no key at all ?
> At least MS-Access 2K told me so.
>
>
> May someone give me a pointer to whats going on, please ?
Unique, primary and foreign keys do not currently inherit to child
tables which causes the behavior you were seeing.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2002-03-07 15:49 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-03-04 11:46 confusing inheritance Andreas F. <maps.on@gmx.net>
2002-03-07 15:49 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox