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 ID reference |
Date: | 2002-03-08 21:51:20 |
Message-ID: | 000801c1c6eb$622bdae0$807ba8c0@inspiron |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Alex,
Most of the Object Relation Mapping I have seen get the id from a
special mechanism, so they know it before hand?
FYI oid's are not guaranteed to be unique in Postgres.
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: Friday, March 08, 2002 3:42 PM
To: pgsql-hackers(at)postgresql(dot)org
Subject: [HACKERS] Object ID reference
Hi I'm new to the list, and I'm new to the PostgreSQL also. But I have
been using Object Relation Mapping for a period of time. I would like to
put native binding with PostgreSQL . It is fairly easy to read and write
Object into the relayed table e.g.
create table base (
myname text,
unique( myname )
);
create table child (
myfather base,
myname text
);
INSERT INTO base ( myname ) Values ( 'alex' ) ;
INSERT 56578 1 <<---- oid
INSERT INTO child ( myfather, myname ) values ( 56578::base, 'alexbaby'
); INSERT 56579 1 <<---- oid
However, there is no way to get the value back in the WHERE clause.
because the return type is 'base' but the value output ( correct me if
I'm wrong from digging the source by hand ) is actually oid returns
int4 from internal seteval() function. select * from child; myfather
myname
-------------------
56578 alexbaby
It could be a easy fix in the jdbc, or c to match the seteval(base.oid)
with int4.[string, string] compare, but then I need to loop through the
full Record Set by hand to get the data. is there a possible way to do
some function to convert the TYPE 'base' to oid or int4 or string? so I
can do something like this
SELECT * from child where myfather=56578::base;
or how am I getting internal seteval to work right with the return set
from a custom function. I really want to see this coming out right...
thanks a lot. Alex
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
From | Date | Subject | |
---|---|---|---|
Next Message | Debian User | 2002-03-08 21:53:13 | Re: Object ID reference |
Previous Message | alex | 2002-03-08 20:57:49 | Object reference |