Thread: does table names have a format and size

does table names have a format and size

From
prakashrj@hotmail.com (jaya prakash)
Date:
Hi,

Is the name of the table important in psql... because the following
create table command doesn't create any table in the database but the
next sql command with a different table name creates the table.

Is there any table name convention in postgres.

create table IL18R---_PGA_SNPs666 (contig char(10),contig_pos
char(10),read_pos char(10),chromat char(30),sample char(30),allele1
char(20),allele2 char(20),ref_pos char(10),ref_sample char(10),tag
char(100),source char(10));

following command works well...

create table MD1_PGA_SNPs666 (contig char(10),contig_pos
char(10),read_pos char(10),chromat char(30),sample char(30),allele1
char(20),allele2 char(20),ref_pos char(10),ref_sample char(10),tag
char(100),source char(10));

thanks
Prakash


Re: does table names have a format and size

From
"Michael Paesold"
Date:
jaya prakash wrote

> Is the name of the table important in psql... because the following
> create table command doesn't create any table in the database but the
> next sql command with a different table name creates the table.
> 
> Is there any table name convention in postgres.
> 
> create table IL18R---_PGA_SNPs666 (contig char(10),contig_pos
> char(10),read_pos char(10),chromat char(30),sample char(30),allele1
> char(20),allele2 char(20),ref_pos char(10),ref_sample char(10),tag
> char(100),source char(10));

I believe the hyphen "-" character is not allowed in a table name.
Only letters, numbers, underscore "_".

Regards, Michael



Re: does table names have a format and size

From
Stephan Szabo
Date:
On 13 Sep 2002, jaya prakash wrote:

> Hi,
> create table command doesn't create any table in the database but the
> next sql command with a different table name creates the table.
>
> Is there any table name convention in postgres.
>
> create table IL18R---_PGA_SNPs666 (contig char(10),contig_pos
> char(10),read_pos char(10),chromat char(30),sample char(30),allele1
> char(20),allele2 char(20),ref_pos char(10),ref_sample char(10),tag
> char(100),source char(10));

I believe - isn't a valid unquoted identifier character.
You can either do "IL18R---_PGA_SNPs666" and always quote the name
or don't use - characters.

I think only letters _ and numbers can be used unquoted (and numbers
can't start), but I haven't checked.



Re: does table names have a format and size

From
"Christopher Kings-Lynne"
Date:
> > Is the name of the table important in psql... because the following
> > create table command doesn't create any table in the database but the
> > next sql command with a different table name creates the table.
> > 
> > Is there any table name convention in postgres.
> > 
> > create table IL18R---_PGA_SNPs666 (contig char(10),contig_pos
> > char(10),read_pos char(10),chromat char(30),sample char(30),allele1
> > char(20),allele2 char(20),ref_pos char(10),ref_sample char(10),tag
> > char(100),source char(10));
> 
> I believe the hyphen "-" character is not allowed in a table name.
> Only letters, numbers, underscore "_".

I think you can probably quote the name to have it work:

create table "IL18R---_PGA_SNPs666" (contig cha...

Chris