From: | Tiffany Thang <tiffanythang(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: creating tables in tablespace |
Date: | 2017-08-24 18:57:25 |
Message-ID: | CAB_W-NNGp9qH_OW2Oo-x0vB89fiJ6G9iWzF9T7FO8-X=u-dTZQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks Tom. As the superuser, I'm able to create the table in the specific
tablespace. Does myuser require additional privileges?
My aim is to be able to create table in a specific tablespace (in this
case, mytablespace) by default without having to explicitly specific one. I
would think that is possible but I'm having trouble making it happen.
postgres=# create table postgrestab (a int) tablespace mytablespace;
CREATE TABLE
postgres=# select tablename,tableowner,tablespace from pg_tables where
tablename like 'post%';
tablename | tableowner | tablespace
-------------+------------+--------------
postgrestab | postgres | mytablespace
(1 row)
Thanks.
On Thu, Aug 24, 2017 at 2:46 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Tiffany Thang <tiffanythang(at)gmail(dot)com> writes:
> > According to the documentation, a table can be created in a specific
> > tablespace by performing the following:
> > 1. Specify the tablespace parameter in the create database statement.
> > 2. Specify the tablespace parameter in the create table statement.
>
> > I've tried both but the tablespace column in pg_tables is empty.
>
> An empty entry in pg_tables means the table is in the database's
> default tablespace, whether you made it that way implicitly or explicitly.
> So this looks as-expected to me. You'd need to spread the database across
> more than one tablespace to get anything in that column.
>
> > "show default_tablespace" is also empty.
>
> If you didn't do anything to change that setting, that would also be
> expected. Again, the interpretation is "use the database's default
> tablespace".
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-08-24 19:07:08 | Re: creating tables in tablespace |
Previous Message | Tom Lane | 2017-08-24 18:46:08 | Re: creating tables in tablespace |