Re: Reference by output in : \d <table_name>

From: "Brendan Jurd" <direvus(at)gmail(dot)com>
To: "kenneth d'souza" <kd_souza(at)hotmail(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Reference by output in : \d <table_name>
Date: 2008-04-14 11:16:31
Message-ID: 37ed240d0804140416h70fd7885vfc2194d3b2b823d1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Apr 14, 2008 at 4:44 PM, kenneth d'souza wrote:
>
> Hi Brendan,
> Your observation is correct.
>
> The indentation is deliberate. The reason is that the (result7,i,3) starts
> with the word "FOREIGN KEY ". I am using the details that follow after this
> blurb.
> All other keywords which are searched in usingpos = strstr(indexdef, "
> KEYWORD ") , the KEYWORD are embedded somewhere in between in the output.
> Hence indentation given is that of four spaces considering the final output
> that it is desired.
>

Sorry Kenneth, I didn't quite follow your explanation. How does the
position of "FOREIGN KEY " affect the indentation at the beginning of
the footer?

I'm getting the following output with HEAD:

"""
postgres=# create table foo (a int primary key);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"foo_pkey" for table "foo"
CREATE TABLE
postgres=# create table bar (a int primary key, foo int not null
references foo);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"bar_pkey" for table "bar"
CREATE TABLE
postgres=# alter table foo add bar int not null references bar;
ALTER TABLE
postgres=# \d foo
Table "public.foo"
Column | Type | Modifiers
- --------+---------+-----------
a | integer | not null
Indexes:
"foo_pkey" PRIMARY KEY, btree (a)
Foreign-key constraints:
"foo_bar_fkey" FOREIGN KEY (bar) REFERENCES bar(a)
Referenced by:
"bar_foo_fkey" IN bar FOREIGN KEY (foo) REFERENCES foo(a)
"""

Note the indent on the constraint listed under "Referenced by" is only
two spaces, instead of the usual four shown under "Indexes" and
"Foreign-key constraints".

The attached patch corrects the indent to the standard four spaces.

Cheers,
BJ
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: http://getfiregpg.org

iD8DBQFIAz0H5YBsbHkuyV0RApFyAJ9PZNbS2p/SO0rNdKSwAjFMxWd0dwCfWd2z
GMhn6Gt3ZAwelpnirDaa+1U=
=Dbuo
-----END PGP SIGNATURE-----

Attachment Content-Type Size
referenced-by-indent.diff text/plain 715 bytes

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-04-14 13:42:10 Re: Reference by output in : \d <table_name>
Previous Message kenneth d'souza 2008-04-14 06:44:00 Re: Reference by output in : \d <table_name>