Skip site navigation (1) Skip section navigation (2)

Re: How to discover foreign keys (without pulling hair out)

From: Ian Morgan <imorgan(at)webcon(dot)net>
To: bob lapique <lapique(at)chez(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to discover foreign keys (without pulling hair out)
Date: 2002-04-25 17:04:22
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
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.

Ian Morgan
 Ian E. Morgan        Vice President & C.O.O.         Webcon, Inc.
 imorgan(at)webcon(dot)net         PGP: #2DA40D07
    *  Customized Linux network solutions for your business  *

In response to

pgsql-sql by date

Next:From: Brubaker, ShaneDate: 2002-04-25 17:25:50
Subject: Collection of PostgreSQL Performance Tips
Previous:From: Tom LaneDate: 2002-04-25 16:57:10
Subject: Re: Again: Identity not discovered by planner?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group