Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 23rd, 2005, 02:20 AM
Thomas F.O'Connell
Guest
 
Posts: n/a
Default Indexes on Expressions -- Parentheses

From 11.5 in the docs:

"The syntax of the CREATE INDEX command normally requires writing
parentheses around index expressions, as shown in the second example.
The parentheses may be omitted when the expression is just a function
call, as in the first example."

But when I try this:

db=# CREATE INDEX expression_idx on some_table( extract( year from
some_column ) );

I get a syntax error corresponding to the open parenthesis after
extract (and whitespace is not the issue).

If I add an enclosing set of parentheses, E.g.:

db=# CREATE INDEX expression_idx on some_table( ( extract( year from
some_column ) ) );

it works!

Is this a known issue?

-tfo
  #2  
Old November 23rd, 2005, 02:20 AM
Stephan Szabo
Guest
 
Posts: n/a
Default Re: Indexes on Expressions -- Parentheses

sszabo@bigpanda.com

On Tue, 28 Sep 2004, Thomas F.O'Connell wrote:
[color=blue]
> From 11.5 in the docs:
>
> "The syntax of the CREATE INDEX command normally requires writing
> parentheses around index expressions, as shown in the second example.
> The parentheses may be omitted when the expression is just a function
> call, as in the first example."
>
> But when I try this:
>
> db=# CREATE INDEX expression_idx on some_table( extract( year from
> some_column ) );[/color]

Extract(year from some_column) is not really just a function call it's
an expression that looks similar to a function call because that's how SQL
defined it.


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

 

Bookmarks

Thread Tools

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles