Functional index adding one

Поиск
Список
Период
Сортировка
От lbarcala@freeresearch.org
Тема Functional index adding one
Дата
Msg-id 59455.193.145.220.56.1215078639.squirrel@mail.freeresearch.org
обсуждение исходный текст
Ответы Re: Functional index adding one  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Re: Functional index adding one  (Sam Mason <sam@samason.me.uk>)
Re: Functional index adding one  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: Memory use in 8.3 plpgsql with heavy use of xpath()
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Functional index adding one