From: | "Dave Cramer" <dave(at)fastcrypt(dot)com> |
---|---|
To: | "'Debian User'" <alex(at)AvengerGear(dot)com>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Object?? -Relational DBMS Postgresql are you sure? |
Date: | 2002-03-12 01:44:03 |
Message-ID: | 00d701c1c967$63e9dd90$807ba8c0@inspiron |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Alex,
Actually I am interested in this.
This works:
select * from child where base.oid=178120
Dave
-----Original Message-----
From: pgsql-hackers-owner(at)postgresql(dot)org
[mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Debian User
Sent: Monday, March 11, 2002 12:28 PM
To: pgsql-hackers(at)postgresql(dot)org
Subject: [HACKERS] Object?? -Relational DBMS Postgresql are you sure?
I guess no body really read my last two emails. Try to get some
attention from the topic this time see anyone
care to answer my simple question. I know from the core design of
postgres has object extension vision.
But is there anyone here still working on the object possiblity in
postgres?
I understand you guys were busy working on the SQL 99 standard. Thanks
for your time. Here is my answer for my last question, just in cast
someone out there still try to use object database. ( trying ) :)
#include "postgres.h"
#include "fmgr.h"
#include "executor/executor.h"
#include "utils/geo_decls.h"
Datum spycastoid(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(spycastoid);
Datum
spycastoid(PG_FUNCTION_ARGS){
TupleTableSlot *t = (TupleTableSlot *) PG_GETARG_POINTER(0);
int32 slot = PG_GETARG_INT32(1);
int32 myid;
bool isnull;
myid = DatumGetInt32(GetAttributeByNum(t, slot, &isnull));
if (isnull)
PG_RETURN_INT32(0);
PG_RETURN_INT32(myid);
}
when the table is created one or two thing need to be done
CREATE TABLE base (
myname text,
);
CREATE UNIQUE INDEX spy_unique_key ON base ( oid, myname ) ;
CREATE TABLE child (
myfather base,
myname text
);
CREATE FUNCTION spycast( child , int4 ) RETURNS int4 // (
myObjectClass_OwnedBy_TableName, myAttributeNum )
AS '/spycastoid.so' LANGUAGE 'c';
CREATE FUNCTION spycast( child ) RETURNS int4 // (
myObjectClass_OwnedBy_TableName )
AS 'select spycast($1,1 );' LANGUAGE 'sql'; // make this programmable
INSERT INTO base ( myname ) Values ( 'alex' ) ;
INSERT 56578 1 <<---- oid
INSERT INTO child ( myfather, myname ) values ( 56578::base, 'alexbaby'
); INSERT 56579 1 <<---- oid
now you can do
SELECT * FROM child WHERE spycast( child ) = 56578 ;
Alex
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
From | Date | Subject | |
---|---|---|---|
Next Message | Tatsuo Ishii | 2002-03-12 02:01:17 | Re: numeric/decimal docs bug? |
Previous Message | Tom Lane | 2002-03-12 01:11:11 | Re: Allowing usernames in pg_hba.conf |