pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ian Morgan <imorgan@webcon.net>
To: bob lapique <lapique@chez.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to discover foreign keys (without pulling hair out)
Date: Thu, 25 Apr 2002 13:04:22 -0400 (EDT)
Message-ID: <Pine.LNX.4.44.0204251254120.29984-100000@light.webcon.net> (raw)
In-Reply-To: <GV4IL0$C9D156E91C6CCD1198F670F63041C3D5@tiscali.fr>

On Thu, 25 Apr 2002, bob lapique wrote:

> I use pgAdminII on Windows. It connects to a PostgreSQL on a Linux PC.
> When you click on an existing table's icon, it shows you a script that
> could have created it (it detects the structure of the table by itself),
> including the foreign keys. That's an easy way. But maybe not very
> elegant...

I have in fact tried that very thing. pgAdminII has a Log View that is
supposed to show all the back-end SQL that it executes in order to show you
what it does. However, all it really does is retrieve the pg_triggers.tgargs
field, which is 6 fields separated by \0's, then it must parse it internally.

I'm looking for a way to parse 'one\000two\000three\000'::bytea into

 foo1 | foo2 | foo3
------+------+-------
 one  | two  | three

using only (Postgre)SQL, no external C functions or the like. Ideas? I'm
looking into PL/pgSQL as a solution, but haven't gotten very far yet.


Regards,
Ian Morgan
-- 
-------------------------------------------------------------------
 Ian E. Morgan        Vice President & C.O.O.         Webcon, Inc.
 imorgan@webcon.net         PGP: #2DA40D07          www.webcon.net
    *  Customized Linux network solutions for your business  *
-------------------------------------------------------------------




view thread (3+ messages)

Message-ID: <Pine.LNX.4.44.0204251254120.29984-100000@light.webcon.net>
Permalink:  ../Pine.LNX.4.44.0204251254120.29984-100000@light.webcon.net/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0204251254120.29984-100000@light.webcon.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: imorgan@webcon.net, lapique@chez.com
  Subject: Re: How to discover foreign keys (without pulling hair out)
  In-Reply-To: <Pine.LNX.4.44.0204251254120.29984-100000@light.webcon.net>
  References: <GV4IL0$C9D156E91C6CCD1198F670F63041C3D5@tiscali.fr> <Pine.LNX.4.44.0204251254120.29984-100000@light.webcon.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox