Object?? -Relational DBMS Postgresql are you sure?

From: alex(at)AvengerGear(dot)com (Debian User)
To: pgsql-hackers(at)postgresql(dot)org
Subject: Object?? -Relational DBMS Postgresql are you sure?
Date: 2002-03-11 17:28:19
Message-ID: 20020311112819.A31190@AvengerGear.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dominic J. Eidson 2002-03-11 18:08:36 Re: Allowing usernames in pg_hba.conf
Previous Message Bruce Momjian 2002-03-11 17:09:34 Re: [HACKERS] Nice Oracle tuning article