473,395 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Index on computed column

Hi,

Can anyone explain to me what I'm doing wrong:
(The first select is to show that the function rubriek exists, and does work).
I want to create an index on a computed column:

palga=> select rubriek(rapport, lseek, 'naamvrouw',0) from main
where rapport = 'T098-20900';
rubriek
-----------
Ramrattan
(1 row)
palga=> create index nm_idx on main (rubriek(rapport, lseek, 'naamvrouw',0));
ERROR: parser: parse error at or near "'naamvrouw'" at character 54
palga=>

This is postgresql-7.3.4-3.rhl9.

Thanks in advance,

Han Holl
Nov 23 '05 #1
7 2627
On Tue, Apr 20, 2004 at 12:48:42PM -0700, Han Holl wrote:
Can anyone explain to me what I'm doing wrong:
(The first select is to show that the function rubriek exists, and does work).
I want to create an index on a computed column:


Functional indexes could not have constants in 7.3; you can build a
wrapper function with the constant embedded, and create an index using
the wrapper function.

Or you can just use 7.4.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"La virtud es el justo medio entre dos defectos" (Aristóteles)

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #2
On Tue, Apr 20, 2004 at 12:48:42PM -0700, Han Holl wrote:
Can anyone explain to me what I'm doing wrong:
(The first select is to show that the function rubriek exists, and does work).
I want to create an index on a computed column:


Functional indexes could not have constants in 7.3; you can build a
wrapper function with the constant embedded, and create an index using
the wrapper function.

Or you can just use 7.4.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"La virtud es el justo medio entre dos defectos" (Aristóteles)

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #3

On Tue, 20 Apr 2004, Han Holl wrote:
palga=> create index nm_idx on main (rubriek(rapport, lseek, 'naamvrouw',0));
ERROR: parser: parse error at or near "'naamvrouw'" at character 54
palga=>

This is postgresql-7.3.4-3.rhl9.


You cannot create functional indexes with a constant in the 7.3 series.
This capability was only added in the 7.4 series. You can work around
this problem by creating a wrapper function that calls the real function
with the constants and creating the index on the wrapper function.

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #4

On Tue, 20 Apr 2004, Han Holl wrote:
palga=> create index nm_idx on main (rubriek(rapport, lseek, 'naamvrouw',0));
ERROR: parser: parse error at or near "'naamvrouw'" at character 54
palga=>

This is postgresql-7.3.4-3.rhl9.


You cannot create functional indexes with a constant in the 7.3 series.
This capability was only added in the 7.4 series. You can work around
this problem by creating a wrapper function that calls the real function
with the constants and creating the index on the wrapper function.

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #5
On Tue, 20 Apr 2004, Han Holl wrote:
Hi,

Can anyone explain to me what I'm doing wrong:
(The first select is to show that the function rubriek exists, and does work).
I want to create an index on a computed column:

palga=> select rubriek(rapport, lseek, 'naamvrouw',0) from main
where rapport = 'T098-20900';
rubriek
-----------
Ramrattan
(1 row)
palga=> create index nm_idx on main (rubriek(rapport, lseek, 'naamvrouw',0));
ERROR: parser: parse error at or near "'naamvrouw'" at character 54
palga=>

This is postgresql-7.3.4-3.rhl9.


In 7.3, functional indexes can only be across columns of the table, so
something like the above is illegal. You can get around this my making a
function that hardcodes the constants and then use that in the index and
queries.

In 7.4, you can index a more general set of expressions.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #6
On Tue, 20 Apr 2004, Han Holl wrote:
Hi,

Can anyone explain to me what I'm doing wrong:
(The first select is to show that the function rubriek exists, and does work).
I want to create an index on a computed column:

palga=> select rubriek(rapport, lseek, 'naamvrouw',0) from main
where rapport = 'T098-20900';
rubriek
-----------
Ramrattan
(1 row)
palga=> create index nm_idx on main (rubriek(rapport, lseek, 'naamvrouw',0));
ERROR: parser: parse error at or near "'naamvrouw'" at character 54
palga=>

This is postgresql-7.3.4-3.rhl9.


In 7.3, functional indexes can only be across columns of the table, so
something like the above is illegal. You can get around this my making a
function that hardcodes the constants and then use that in the index and
queries.

In 7.4, you can index a more general set of expressions.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #7
Hello Alvaro, Kris and Stephan,

Thank you for your help. I apologize for reacting so late, but I've
been on vacation.
I must say I'm amazed that I post a question on April 20, and get
three almost identical, equally helpful, reactions after six days,
posted in the same hour!

I'm puzzled but grateful,

Han Holl
Nov 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: tperovic | last post by:
Using SS2K, I'm getting the following error while bulk inserting: Column 'warranty_expiration_date' cannot be modified because it is a computed column. Here is my bulk insert statement: ...
9
by: DMAC | last post by:
If i want to split a computed column into two or more columns based on the the length (its a varchar) of the computed column, how often will sql server determine what the computed column is?...
0
by: Jim Heavey | last post by:
Hello, I have created a computed column which concatenates a name and date. My problem is that if the 10 is not 10 characters, I get an extra character placed into the computed column. Here is the...
0
by: Han Holl | last post by:
Hi, Can anyone explain to me what I'm doing wrong: (The first select is to show that the function rubriek exists, and does work). I want to create an index on a computed column: palga=>...
2
by: Jon Lapham | last post by:
I have a table that stores TEXT information. I need query this table to find *exact* matches to the TEXT... no regular expressions, no LIKE queries, etc. The TEXT could be from 1 to 10000+...
8
by: paulmac106 | last post by:
I have a table with a few million records and I need to search and return rows where a varchar(1000) field has the value "Showed" SQL will not allow me to add an index for a field of this length....
6
by: jim_geissman | last post by:
Can I create an index on a variation of a column that isn't actually in the table? I have a ParcelNumber column, with values like 123 AB-670 12345ABC 000-00-040 12-345-67 AP34567890
2
by: Dot Net Daddy | last post by:
Hello, I want to assign a column a computed value, which is the multiplication of a value from the table within and a value from another table. How can I do that?
7
by: Aamir Mahmood | last post by:
Hi All I have DataTable object. Is there a way that I can know which fields (columns) in the table are computed. Apparantly the DataTable.Columns returns all columns both computed and other....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.