Re: Reference by output in : \d - Mailing list pgsql-patches

From Brendan Jurd
Subject Re: Reference by output in : \d
Date
Msg-id 37ed240d0804140416h70fd7885vfc2194d3b2b823d1@mail.gmail.com
Whole thread Raw
In response to Re: Reference by output in : \d  (kenneth d'souza <kd_souza@hotmail.com>)
Responses Re: Reference by output in : \d  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-patches by date:

Previous
From: kenneth d'souza
Date:
Subject: Re: Reference by output in : \d
Next
From: Tom Lane
Date:
Subject: Re: Reference by output in : \d