Include tablespace information in psql \d footers

Started by Gavin Sherryabout 22 years ago6 messagespatches
Jump to latest
#1Gavin Sherry
swm@linuxworld.com.au

Attached.

There is no other way at the moment to get the tablespace name of an
object in psql.

We get information for tables, index, sequences and toast tables.

We should probably do this for schemas too...

Gavin

Attachments:

psql_tablespace.difftext/plain; charset=US-ASCII; name=psql_tablespace.diffDownload+86-37
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Gavin Sherry (#1)
Re: Include tablespace information in psql \d footers

Gavin Sherry <swm@linuxworld.com.au> writes:

Attached.

Couple of problems with this:

1. Don't #ifndef WIN32 it. In the first place, we might have tablespace
support on Windows later, and in the second place, even if psql is
running on Windows that doesn't mean the server it's talking to is.

2. Printing "pg_default" when reltblspace is zero is wrong. Get the
database's default tablespace and print that. Or perhaps better,
don't print anything at all; that would avoid cluttering the display
for people who don't use tablespaces.

regards, tom lane

#3Gavin Sherry
swm@linuxworld.com.au
In reply to: Tom Lane (#2)
Re: Include tablespace information in psql \d footers

On Fri, 25 Jun 2004, Tom Lane wrote:

Gavin Sherry <swm@linuxworld.com.au> writes:

Attached.

Couple of problems with this:

1. Don't #ifndef WIN32 it. In the first place, we might have tablespace
support on Windows later, and in the second place, even if psql is
running on Windows that doesn't mean the server it's talking to is.

Oops.

2. Printing "pg_default" when reltblspace is zero is wrong. Get the
database's default tablespace and print that. Or perhaps better,
don't print anything at all; that would avoid cluttering the display
for people who don't use tablespaces.

Ahhh yes of course. Attached is a patch with docs which excludes reporting
of the default tablespace.

Gavin

Attachments:

psql_tablespace2.difftext/plain; charset=US-ASCII; name=psql_tablespace2.diffDownload+78-36
#4Bruce Momjian
bruce@momjian.us
In reply to: Gavin Sherry (#3)
Re: Include tablespace information in psql \d footers

Patch applied. Thanks.

I removed the display of tablespaces for sequences and toast tables:

test=> \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+-----------
x | integer |

test=> \d test2
Table "public.test2"
Column | Type | Modifiers
--------+---------+-----------
x | integer |
Tablespace:
"tmp"

Why is the tablespace name printed on a separate line?

---------------------------------------------------------------------------

Gavin Sherry wrote:

On Fri, 25 Jun 2004, Tom Lane wrote:

Gavin Sherry <swm@linuxworld.com.au> writes:

Attached.

Couple of problems with this:

1. Don't #ifndef WIN32 it. In the first place, we might have tablespace
support on Windows later, and in the second place, even if psql is
running on Windows that doesn't mean the server it's talking to is.

Oops.

2. Printing "pg_default" when reltblspace is zero is wrong. Get the
database's default tablespace and print that. Or perhaps better,
don't print anything at all; that would avoid cluttering the display
for people who don't use tablespaces.

Ahhh yes of course. Attached is a patch with docs which excludes reporting
of the default tablespace.

Gavin

Content-Description:

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#5Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#4)
Re: Include tablespace information in psql \d footers

Bruce Momjian wrote:

Patch applied. Thanks.

I removed the display of tablespaces for sequences and toast tables:

test=> \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+-----------
x | integer |

test=> \d test2
Table "public.test2"
Column | Type | Modifiers
--------+---------+-----------
x | integer |
Tablespace:
"tmp"

Why is the tablespace name printed on a separate line?

OK, I moved the tablespace name up on to the same line just like Has
oids:

test=> \d+ test3
Table "public.test3"
Column | Type | Modifiers | Description
--------+---------+-----------+-------------
x | integer | not null |
Indexes:
"test3_pkey" PRIMARY KEY, btree (x)
Contains OIDs: yes
Tablespace: "tmp"

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#6Gavin Sherry
swm@linuxworld.com.au
In reply to: Bruce Momjian (#5)
Re: Include tablespace information in psql \d footers

On Mon, 12 Jul 2004, Bruce Momjian wrote:

Bruce Momjian wrote:

Patch applied. Thanks.

I removed the display of tablespaces for sequences and toast tables:

test=> \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+-----------
x | integer |

test=> \d test2
Table "public.test2"
Column | Type | Modifiers
--------+---------+-----------
x | integer |
Tablespace:
"tmp"

Why is the tablespace name printed on a separate line?

OK, I moved the tablespace name up on to the same line just like Has
oids:

Works for me.

Thanks,

Gavin