473,503 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding Indexes to Functions

Hi,

I have a table, where one of the columns "extradata" is a gob of XML.
I'd like to be able to create an index on this function.. so i tried
this
CREATE INDEX actitemsXML_idx ON act_items
(pgxml_xpath(extradata,'//RequestInfo/refund_id/text()','',''));

And i got this nice little error

ERROR: parser: parse error at or near
"'//RequestInfo/refund_id/text()'" at character 66

I tried escaping the single quotes.. that basically leaves me at a psql
prompt with a ', meaning i need to close my quote, but they're all
escaped.

If anyone has any input for adding index's on functions that have single
quotes in them, that would be great.

Thanks.

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

Nov 12 '05 #1
2 1336
On Mon, Oct 06, 2003 at 11:15:06 -0300,
Jeff MacDonald <in**@bignose.ca> wrote:
Hi,

I have a table, where one of the columns "extradata" is a gob of XML.
I'd like to be able to create an index on this function.. so i tried
this
CREATE INDEX actitemsXML_idx ON act_items
(pgxml_xpath(extradata,'//RequestInfo/refund_id/text()','',''));


I don't think that you can create indexes on functions that had expressions
or constants for parameter values in 7.3 and earlier. You might want to
try this with the 7.4 beta and see if it works there. There will probably
be a 7.4 release candidate this week, so you may be able to consider
7.4 for production soon.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #2

On Mon, 6 Oct 2003, Jeff MacDonald wrote:
I have a table, where one of the columns "extradata" is a gob of XML.
I'd like to be able to create an index on this function.. so i tried
this

CREATE INDEX actitemsXML_idx ON act_items
(pgxml_xpath(extradata,'//RequestInfo/refund_id/text()','',''));

And i got this nice little error

ERROR: parser: parse error at or near
"'//RequestInfo/refund_id/text()'" at character 66

I tried escaping the single quotes.. that basically leaves me at a psql
prompt with a ', meaning i need to close my quote, but they're all
escaped.

If anyone has any input for adding index's on functions that have single
quotes in them, that would be great.


In 7.3 (and earlier), functional indexes must be defined on a function
over columns in the table. You cannot put fixed parameters in the call.
You can generally hack around this by making a function on only the
columns that calls the function with the constant arguments.

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

http://archives.postgresql.org

Nov 12 '05 #3

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

Similar topics

2
4954
by: Chris | last post by:
Any help would be appreciated. I am running a script that does the following in succession. 1-Drop existing database and create new database 2-Defines tables, stored procedures and functions...
1
3094
by: Zack Sessions | last post by:
Still using SQL7. I am wondering how come there is not an Information_Schema view that lists indexes? Information_Schema is supposed to be the safest way to obtain information on metadata, but...
2
14469
by: Jennifer | last post by:
I've got a table with 36+ million rows. I've been asked to modify the table and add in an identity column. The code I used caused SQL to lock up and it maxed out the log files. :) The code I...
4
3836
by: Tryfon Gavriel | last post by:
Hi all I recently noticed when trying to optimise a major query of a chess website I am the webmaster of, that adding an order by for "gamenumber" which is a clustered index field as in for...
5
2775
by: Paul | last post by:
Hi I have a table that currently has 466 columns and about 700,000 records. Adding a new DEFAULT column to this table takes a long time. It it a lot faster to recreate the table with the new...
2
1467
by: David Shadovitz | last post by:
I need to add a column to a table. This table holds several thousand records, has several indexes, and serves as the parent table to a few child tables. When I've done this in the past, it has...
47
3830
by: Albert | last post by:
So structures are useful to group variables, so you can to refer to a collection as a single entity. Wouldn't it be useful to also have the ability to collect variable and functions? Ask K&R...
8
3261
by: shumaker | last post by:
I'm wondering if adding an autonumber primary key will improve the performance of a multiuser access database on a network share. I have a website that lists many tips for improving performance of...
0
1185
by: okonita | last post by:
Hi all, I need to create one or two indexes on date columns to support MAX and MIN aggregate functions on a very large table and to make the SQL perform/run faster. I remember a group discussion...
0
7202
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
7280
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
7330
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
7460
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...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.