Create empty table in postgresql -


i want create simple table inside database in postgresql. documentation have create table create new, empty table in current database. table owned user issuing command. command

create table *table_name*; 

i thought new empty table.but psql throws error: syntax error @ or near ";". when user empty argument list like:

create table *table_name*(); 

psql tells me table created through

postgres=# create table *table_name*(); create table 

but \l shows not showing newly created table. , not possible login psql -d table_name -u user_name. can help?

you can have table no columns, , rows in it:

create table nocolumn (dummy integer not null primary key)     ;  insert nocolumn(dummy) values (1);  alter table nocolumn         drop column dummy;  \d nocolumn  select count(*) nocolumn; 

output:

create table insert 0 1 alter table    table "tmp.nocolumn"  column | type | modifiers  --------+------+-----------   count  -------      1 (1 row) 

Comments