X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CE6D4D83C3 for ; Fri, 28 Oct 2005 10:59:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42919-09 for ; Fri, 28 Oct 2005 13:59:06 +0000 (GMT) Received: from iracema.dnscenter.com.br (iracema3.dnscenter.com.br [67.15.81.2]) by svr1.postgresql.org (Postfix) with ESMTP id 03607DB222 for ; Fri, 28 Oct 2005 10:59:07 -0300 (ADT) Received: from cpanel by iracema.dnscenter.com.br with local (Exim 4.52) id 1EVUlA-00056V-MF for pgsql-sql@postgresql.org; Fri, 28 Oct 2005 10:59:08 -0300 Received: from 200.158.187.193 ([200.158.187.193]) by www.presserv.org (Horde MIME library) with HTTP; Fri, 28 Oct 2005 10:59:08 -0300 Message-ID: <20051028105908.onaegu44ynnog8os@www.presserv.org> Date: Fri, 28 Oct 2005 10:59:08 -0300 From: lucas@presserv.org To: pgsql-sql@postgresql.org Subject: Fwd: Re: Referencing MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.0.3) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - iracema.dnscenter.com.br X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [32001 502] / [47 12] X-AntiAbuse: Sender Address Domain - presserv.org X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.801 required=5 tests=[AWL=-0.899, NO_REAL_NAME=0.55, RCVD_IN_NJABL_PROXY=0.327, RCVD_IN_SORBS_SOCKS=1.823] X-Spam-Score: 1.801 X-Spam-Level: * X-Archive-Number: 200510/383 X-Sequence-Number: 23236 Ok, But the problem is becouse the "buy" and "send" tables referencing with oth= er father table, wich is different. I shoud not create a spent table to put the "buy" and "send" values becouse the entire database is more complex than it. look: create table output( id serial primary key, client integer references clientes, fiscal_number varchar(30), print_date date, ... ); create table SEND( id serial primary key, output integer references input, product_id integer,--references.... value money ); create table input( id serial primary key, supplier integer references suppliers, employee varchar(30), ... ); create table BUY( id serial primary key, input integer references input, product_id integer,--references.... value money ); ---and--- create table financial( id serial primary key, cred_deb smallint, value money, references integer references ???, --<<-HERE IS THE PROBLEM, it will reference to buy OR send table ); How looked, the "buy" and the "send" table is identical except the father references (INPUT or OUTPUT)... Then I shoud not create ONE table (spent) w= ich has these informations. And now my question: Is there a way to references (financial) with two diferents tables in the some row? Or need I create two diferents rows??? Thanks. (sorry for my english). Quoting William Leite Ara=FAjo : > Maybe you need is a table "spent" that has all fields of > buy/send and one more, a flag to say is the field is a "buy" or a > "send". > > > 2005/10/27, lucas@presserv.org : >> Hi. >> Is there a way to references dynamic tables? I.E: >> I have a table called "buy" that create some records in "financial" >> table, but >> there is other table called "send" that create other records in "financi= al". >> "Financial" table have the moneys' movements and needs to be >> referenciable by >> "buy or send". IE: >> create table buy ( >> id serial primary key, >> product_id integer,--references.... >> value money >> ); >> create table send ( >> id serial primary key, >> product_id integer, --references... >> value money >> ); >> create table financial( >> id serial primary key, >> cred_deb smallint, >> value money, >> references integer, --<<-HERE IS THE PROBLEM, it will reference to >> buy OR send >> table >> ); >> Well, I dont know if I was clean. >> Thank you. >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 1: if posting/reading through Usenet, please send an appropriate >> subscribe-nomail command to majordomo@postgresql.org so that your >> message can get through to the mailing list cleanly >> > > > -- > William Leite Ara=FAjo >