dbTalk Databases Forums  

index names

comp.databases.postgresql comp.databases.postgresql


Discuss index names in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Anselmo Canfora
 
Posts: n/a

Default index names - 01-19-2010 , 07:53 AM






Hi,
is there a way to have a default index name for columns?
for example, instead of writing:

create index foo on bar (foo);

write only:
create index on bar (foo);

or better:

create index on bar.foo;

Reply With Quote
  #2  
Old   
Andreas Kretschmer
 
Posts: n/a

Default Re: index names - 01-19-2010 , 09:57 AM






Anselmo Canfora <nobody (AT) nowhere (DOT) net> wrote:
Quote:
Hi,
is there a way to have a default index name for columns?
for example, instead of writing:

create index foo on bar (foo);

write only:
create index on bar (foo);

or better:

create index on bar.foo;
Tom Lane commited such a feature, see:
http://www.postgresql.org/community/...ws/pwn20091227
- Allow the index name to be omitted in CREATE INDEX, causing the system
to choose an index name the same as it would do for an unnamed index
constraint


Andreas
--
Andreas Kretschmer
Linux - weil ich es mir wert bin!
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net

Reply With Quote
  #3  
Old   
Thomas Kellerer
 
Posts: n/a

Default Re: index names - 01-19-2010 , 10:16 AM



Andreas Kretschmer, 19.01.2010 15:57:
Quote:
Anselmo Canfora<nobody (AT) nowhere (DOT) net> wrote:
Hi,
is there a way to have a default index name for columns?
for example, instead of writing:

create index foo on bar (foo);

write only:
create index on bar (foo);

or better:

create index on bar.foo;

Tom Lane commited such a feature, see:
http://www.postgresql.org/community/...ws/pwn20091227
- Allow the index name to be omitted in CREATE INDEX, causing the system
to choose an index name the same as it would do for an unnamed index
constraint

Nice one.

Does "Tom Lane commited" mean, that this will definitely appear in 8.5 (aka "next version)?
Or does it need some kind of review/approval process that might cause it to not appear in the next version?

Regards
Thomas

Reply With Quote
  #4  
Old   
Andreas Kretschmer
 
Posts: n/a

Default Re: index names - 01-19-2010 , 11:03 AM



Thomas Kellerer <OTPXDAJCSJVU (AT) spammotel (DOT) com> wrote:
Quote:
Andreas Kretschmer, 19.01.2010 15:57:
Tom Lane commited such a feature, see:
http://www.postgresql.org/community/...ws/pwn20091227
- Allow the index name to be omitted in CREATE INDEX, causing the system
to choose an index name the same as it would do for an unnamed index
constraint


Nice one.

Does "Tom Lane commited" mean, that this will definitely appear in 8.5 (aka "next version)?
Or does it need some kind of review/approval process that might cause it to not appear in the next version?
I don't know, sorry. But i think, commited means this feature will be in
8.4+1 ;-)


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

Reply With Quote
  #5  
Old   
Anselmo Canfora
 
Posts: n/a

Default Re: index names - 01-20-2010 , 02:42 PM



Il 19/01/2010 17.03, Andreas Kretschmer ha scritto:
Quote:
Thomas Kellerer<OTPXDAJCSJVU (AT) spammotel (DOT) com> wrote:
Andreas Kretschmer, 19.01.2010 15:57:
Tom Lane commited such a feature, see:
http://www.postgresql.org/community/...ws/pwn20091227
- Allow the index name to be omitted in CREATE INDEX, causing the system
to choose an index name the same as it would do for an unnamed index
constraint


Nice one.

Does "Tom Lane commited" mean, that this will definitely appear in 8.5 (aka "next version)?
Or does it need some kind of review/approval process that might cause it to not appear in the next version?

I don't know, sorry. But i think, commited means this feature will be in
8.4+1 ;-)


Andreas
Fine is there a plan to do something similar on cases such, for example:

alter table foo add constraint constraint_name check (bar between 0 and
255);

that would be turn into:

alter table foo add constraint check (bar between 0 and 255);

Anselmo

Reply With Quote
  #6  
Old   
Anselmo Canfora
 
Posts: n/a

Default Re: index names - 01-21-2010 , 10:28 AM



Il 20/01/2010 20.42, Anselmo Canfora ha scritto:
Quote:
Il 19/01/2010 17.03, Andreas Kretschmer ha scritto:
Thomas Kellerer<OTPXDAJCSJVU (AT) spammotel (DOT) com> wrote:
Andreas Kretschmer, 19.01.2010 15:57:
Tom Lane commited such a feature, see:
http://www.postgresql.org/community/...ws/pwn20091227
- Allow the index name to be omitted in CREATE INDEX, causing the
system
to choose an index name the same as it would do for an unnamed index
constraint


Nice one.

Does "Tom Lane commited" mean, that this will definitely appear in
8.5 (aka "next version)?
Or does it need some kind of review/approval process that might cause
it to not appear in the next version?

I don't know, sorry. But i think, commited means this feature will be in
8.4+1 ;-)


Andreas

Fine is there a plan to do something similar on cases such, for example:

alter table foo add constraint constraint_name check (bar between 0 and
255);
mine was a question, just misesd the question mark
is there a plan to release similar autonaming feature for, for example,
constraints?
just a remark, perhaps would be good to use a hierarchy schema for
autonaming, something like "type_schema_table_column", this can get a
better behavior when using autocompletion with "\d"

Reply With Quote
  #7  
Old   
Bernd Nawothnig
 
Posts: n/a

Default Re: index names - 01-21-2010 , 10:30 AM



On 2010-01-19, Anselmo Canfora wrote:

Quote:
is there a way to have a default index name for columns? for
example, instead of writing:

create index foo on bar (foo);

write only: create index on bar (foo);
Indeed, that would be a usefull feature.

Quote:
or better:

create index on bar.foo;
Your second proposal will not work for the general case because you
can index a tupel of columns not necessarily only one column.



Bernd

--
Moralische Entrüstung ist der Heiligenschein der Scheinheiligen.

[Helmut Qualtinger]

Reply With Quote
  #8  
Old   
Anselmo Canfora
 
Posts: n/a

Default Re: index names - 01-21-2010 , 04:00 PM



[CUT]
Quote:
create index on bar.foo;

Your second proposal will not work for the general case because you
can index a tupel of columns not necessarily only one column.
perhaps:

create index on (bar.first, bar.second);

would work?

Reply With Quote
  #9  
Old   
Bob Badour
 
Posts: n/a

Default Re: index names - 01-21-2010 , 04:41 PM



Anselmo Canfora wrote:

Quote:
[CUT]

create index on bar.foo;


Your second proposal will not work for the general case because you
can index a tupel of columns not necessarily only one column.


perhaps:

create index on (bar.first, bar.second);

would work?
Why would anyone want to repeat bar ad infinitum?

--
is there something in it for them, like maybe bailouts, if they can
panic us into doing something politically to cover them?

November 19, 2007 - John S Bolton

http://tinyurl.com/y9e4vxh

Reply With Quote
  #10  
Old   
Anselmo Canfora
 
Posts: n/a

Default Re: index names - 01-21-2010 , 04:46 PM



Il 21/01/2010 22.41, Bob Badour ha scritto:
Quote:
Anselmo Canfora wrote:

[CUT]

create index on bar.foo;


Your second proposal will not work for the general case because you
can index a tupel of columns not necessarily only one column.


perhaps:

create index on (bar.first, bar.second);

would work?

Why would anyone want to repeat bar ad infinitum?

You right, period

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.