Received: from prtr-13.ucsc.edu (prtr-13.ucsc.edu [128.114.166.121]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBF1qu056848 for ; Thu, 14 Dec 2000 20:52:56 -0500 (EST) (envelope-from badger@prtr-13.ucsc.edu) Received: by prtr-13.ucsc.edu (Postfix, from userid 500) id 4BF0230323; Thu, 14 Dec 2000 17:53:18 -0800 (PST) Date: Thu, 14 Dec 2000 17:53:18 -0800 From: Toshio Kuratomi To: pgsql-php@postgresql.org Subject: references (foreign keys) and selection lists Message-ID: <20001214175318.C20751@prtr-13.ucsc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-Operating-System: Linux prtr-13.ucsc.edu 2.2.16 X-Archive-Number: 200012/19 X-Sequence-Number: 62 Hi, In my database I have several references between tables. When webifying an insert form it seemed to me that these would best be represented as a selection list. Currently I'm using this: SQL: select t.tgargs from pg_class c, pg_trigger where t.tgrelid = c.oid and c.relname='mytable'; returns values like this: "\000mytable\000myothertable\000UNSPECIFIED\000type\000category\000" PHP: record = split on '\000'; when record[1] matches mytable: [If it doesn't match mytable, then this table is being referenced as opposed to referencing] SQL: select record[5] from record[2]; PHP: construct selection list from the returned list Question: Is \000 an official separator between targs fields or is 000 part of a number that may change for some reason? Also -- is this the best way to solve my problem? It seems a little inelegant to perform the middle split and match in the calling script, but I can't figure out how to do it in SQL (tgargs is type bytea which doesn't respond to regex operators.... What is a bytea anyhow?) Last question -- Is there any documentation of the system tables (pg_*)? I've found several useful fields in several tables, but I'm far from understanding most of what's in there. Thanks, Toshio -- badger \ "I sometimes wonder: where is it all going? @prtr-13 \ Which makes me stop to wonder: what is it?" .ucsc.edu \~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ GA->ME 1999