Object?? -Relational DBMS Postgresql are you sure? - Mailing list pgsql-hackers

From alex@AvengerGear.com (Debian User)
Subject Object?? -Relational DBMS Postgresql are you sure?
Date
Msg-id 20020311112819.A31190@AvengerGear.com
Whole thread Raw
Responses Re: Object?? -Relational DBMS Postgresql are you sure?  ("Dave Cramer" <dave@fastcrypt.com>)
List pgsql-hackers
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 




pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Time for 7.2.1?
Next
From: "Dominic J. Eidson"
Date:
Subject: Re: Allowing usernames in pg_hba.conf