pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Sequence name length
5+ messages / 3 participants
[nested] [flat]

* Sequence name length
@ 2002-07-17 02:38 Rudi Starcevic <rudi@oasis.net.au>
  2002-07-17 02:49 ` Re: Sequence name length Christopher Kings-Lynne <chriskl@familyhealth.com.au>
  2002-07-17 03:40 ` Re: Sequence name length Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 5+ messages in thread

From: Rudi Starcevic @ 2002-07-17 02:38 UTC (permalink / raw)
  To: pgsql-sql

Hi,

Just a quick one on the length of the name of a sequence.

I have some table with long(ish) names like :     eselect_maincategory
The primary key is named :     maincat_id

When I create the table the sequence sql  looks like     
nextval('"eselect_maincategory_maincat_id_seq"'::text)

However the sequence created is named :     
eselect_maincategory_maincat_id     ( the '_seq' is lopped off )

This looke like a max of 31 characters.

Is a sequence name length limited to 31 characters or is it the tool I'm 
using - phpPgAdmin, I wonder ?

Your time and thoughts are very much appreciated.
Thank you.
Rudi Starcevic.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Sequence name length
  2002-07-17 02:38 Sequence name length Rudi Starcevic <rudi@oasis.net.au>
@ 2002-07-17 02:49 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
  1 sibling, 0 replies; 5+ messages in thread

From: Christopher Kings-Lynne @ 2002-07-17 02:49 UTC (permalink / raw)
  To: Rudi Starcevic <rudi@oasis.net.au>; pgsql-sql

Hi Rudi,

Unless you redefine it before compiling, postgres has a built-in limit of 31
characters for names.  Increasing this has a performance penalty, but it
might happen for 7.3 due to some improvements in the performance area.

BTW, the best way to do a sequence primary key is lik ethis:

create table blah (
	maincat_id SERIAL
);

Chris

> -----Original Message-----
> From: pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Rudi Starcevic
> Sent: Wednesday, 17 July 2002 10:39 AM
> To: pgsql-sql@postgresql.org
> Subject: [SQL] Sequence name length
>
>
> Hi,
>
> Just a quick one on the length of the name of a sequence.
>
> I have some table with long(ish) names like :     eselect_maincategory
> The primary key is named :     maincat_id
>
> When I create the table the sequence sql  looks like
> nextval('"eselect_maincategory_maincat_id_seq"'::text)
>
> However the sequence created is named :
> eselect_maincategory_maincat_id     ( the '_seq' is lopped off )
>
> This looke like a max of 31 characters.
>
> Is a sequence name length limited to 31 characters or is it the tool I'm
> using - phpPgAdmin, I wonder ?
>
> Your time and thoughts are very much appreciated.
> Thank you.
> Rudi Starcevic.
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Sequence name length
  2002-07-17 02:38 Sequence name length Rudi Starcevic <rudi@oasis.net.au>
@ 2002-07-17 03:40 ` Tom Lane <tgl@sss.pgh.pa.us>
  2002-07-17 03:45   ` Re: Sequence name length Christopher Kings-Lynne <chriskl@familyhealth.com.au>
  2002-07-17 03:51   ` Re: Sequence name length Rudi Starcevic <rudi@oasis.net.au>
  1 sibling, 2 replies; 5+ messages in thread

From: Tom Lane @ 2002-07-17 03:40 UTC (permalink / raw)
  To: Rudi Starcevic <rudi@oasis.net.au>; +Cc: pgsql-sql

Rudi Starcevic <rudi@oasis.net.au> writes:
> Just a quick one on the length of the name of a sequence.
> ...
> However the sequence created is named :     
> eselect_maincategory_maincat_id     ( the '_seq' is lopped off )

What version are you running?  Anything recent will keep the '_seq'
and lop elsewhere.

> This looke like a max of 31 characters.

Yeah, the default NAMEDATALEN is 32, allowing for 31 chars plus a
terminating null.  You can build a private version with larger
NAMEDATALEN, and there are recurring discussions about increasing
the default length.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Sequence name length
  2002-07-17 02:38 Sequence name length Rudi Starcevic <rudi@oasis.net.au>
  2002-07-17 03:40 ` Re: Sequence name length Tom Lane <tgl@sss.pgh.pa.us>
@ 2002-07-17 03:45   ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
  1 sibling, 0 replies; 5+ messages in thread

From: Christopher Kings-Lynne @ 2002-07-17 03:45 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql

> > However the sequence created is named :
> > eselect_maincategory_maincat_id     ( the '_seq' is lopped off )
>
> What version are you running?  Anything recent will keep the '_seq'
> and lop elsewhere.

Not if he's manually creating a sequence name that's too long - it will just
truncate it methinks...

Chris




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Sequence name length
  2002-07-17 02:38 Sequence name length Rudi Starcevic <rudi@oasis.net.au>
  2002-07-17 03:40 ` Re: Sequence name length Tom Lane <tgl@sss.pgh.pa.us>
@ 2002-07-17 03:51   ` Rudi Starcevic <rudi@oasis.net.au>
  1 sibling, 0 replies; 5+ messages in thread

From: Rudi Starcevic @ 2002-07-17 03:51 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql

Hi Tom,

Here is the output from 'select version()'

PostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC 2.95.2

Cheers
Rudi.

Tom Lane wrote:

>Rudi Starcevic <rudi@oasis.net.au> writes:
>  
>
>>Just a quick one on the length of the name of a sequence.
>>...
>>However the sequence created is named :     
>>eselect_maincategory_maincat_id     ( the '_seq' is lopped off )
>>    
>>
>
>What version are you running?  Anything recent will keep the '_seq'
>and lop elsewhere.
>
>  
>
>>This looke like a max of 31 characters.
>>    
>>
>
>Yeah, the default NAMEDATALEN is 32, allowing for 31 chars plus a
>terminating null.  You can build a private version with larger
>NAMEDATALEN, and there are recurring discussions about increasing
>the default length.
>
>			regards, tom lane
>
>  
>






^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2002-07-17 03:51 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-07-17 02:38 Sequence name length Rudi Starcevic <rudi@oasis.net.au>
2002-07-17 02:49 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2002-07-17 03:40 ` Tom Lane <tgl@sss.pgh.pa.us>
2002-07-17 03:45   ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2002-07-17 03:51   ` Rudi Starcevic <rudi@oasis.net.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox