Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Functional inde...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 15965 of 17437
Post > Topic >>

Functional index adding one

by lbarcala@[EMAIL PROTECTED] Jul 3, 2008 at 11:50 AM

Hi all:

I'm trying to create a functional index into column position of token
table (see below). I want to make something like:

CREATE INDEX token_position_func
ON token (position+1);

but I get:

test=# CREATE INDEX token_position_func
test-# ON token (position+1);
ERROR:  syntax error at or near "+"
LINE 2: ON token (position+1);

I read that I can do "ON function(column)" but, is there a built-in
function in PostgreSQL to do what I want (add one to the value) or have i
to build one to make this simple calculation?


CREATE TABLE doc(
  id INT,
  editorial VARCHAR,
  CONSTRAINT doc_pk PRIMARY KEY (id)
);

CREATE TABLE token (
  id INT,
  id_doc INT,
  token VARCHAR,
  position INT,
  CONSTRAINT foreign_doc FOREIGN KEY (id_do)
    REFERENCES doc (identificador)
);

Regards,

  Mario Barcala


-- 
Sent via pgsql-general mailing list (pgsql-general@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
 




 7 Posts in Topic:
Functional index adding one
lbarcala@[EMAIL PROTECTED  2008-07-03 11:50:39 
Re: Functional index adding one
andreas.kretschmer@[EMAIL  2008-07-03 12:11:20 
Re: Functional index adding one
sam@[EMAIL PROTECTED] (S  2008-07-03 14:19:49 
Re: Functional index adding one
tgl@[EMAIL PROTECTED] (T  2008-07-03 11:11:26 
Re: Functional index adding one
sam@[EMAIL PROTECTED] (S  2008-07-03 17:00:31 
Re: Functional index adding one
stark@[EMAIL PROTECTED]   2008-07-03 14:37:18 
Re: Functional index adding one
stark@[EMAIL PROTECTED]   2008-07-03 15:21:50 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 16:43:29 CST 2008.