agora inbox for postgres@postgres.berkeley.edu
help / color / mirror / Atom feedFrom: practica fbd <fbd1@goliat.upc.es>
To: postgres@postgres.Berkeley.EDU
Subject: A little question
Date: Mon, 27 Mar 1995 13:40:39 +0200 (MET DST)
Message-ID: <9503271140.AA10960@goliat.upc.es> (raw)
Hello, we are 3 students from Barcelona who are working with
Postgres 4.1. We have the next problem:
* We need to make reference from an object to another one, using some
kind of 'foreing key' but in a more object oriented style, and we don't
know how. We first tried to do this stuff:
create Thing (.....)\g
create SubThing (reference_to_Thing = Thing)\g
and the answer was:
NOTICE:Mar 27 13:23:19:cannot create attribute of type Thing
WARN:Mar 27 13:23:19:use functions to get complex objects
Therefore we tried another solution which seems to work:
create People (name = text,
kmother = oid,
age = int4) \g
define function mother
(language = "postquel", returntype = People)
arg is (People)
as "retrieve (p.all)
from p in People
where p.oid = $1.kmother" \g
append People (name = "Hillary Clinton", age = "40") \g
append People (name = "Chelsea Clinton", age = "14",
kmother = p.oid)
from p in People
where p.name = "Hillary Clinton" \g
As we said before this works, but is this the best way (the most
correct) to do it in Postgres?
Thank You for your collaboration.
Pedro, Oscar & Eduard : Postgres Team
e-mail: fbd1@lsi.upc.es
Facultat d'Informatica de Barcelona (F.I.B.),
Universitat Politecnica de Catalunya (U.P.C.),
Barcelona, Spain
==============================================================================
To add/remove yourself to/from the POSTGRES mailing list: send mail with
the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU".
If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
a human will deal with it. DO NOT post to the "postgres" mailing list.
==============================================================================
URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: postgres@postgres.berkeley.edu
Cc: fbd1@goliat.upc.es
Subject: Re: A little question
In-Reply-To: <9503271140.AA10960@goliat.upc.es>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox