Alex,
Actually I am interested in this.
This works:
select * from child where base.oid=178120
Dave
-----Original Message-----
From: pgsql-hackers-owner@postgresql.org
[mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Debian User
Sent: Monday, March 11, 2002 12:28 PM
To: pgsql-hackers@postgresql.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?
http://archives.postgresql.org