Search Postgresql Archives

Re: creating tables in tablespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx> wrote:
Tiffany Thang <tiffanythang@xxxxxxxxx> 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux