Re: can't create index with 'dowcast' row
От | marcelo Cortez |
---|---|
Тема | Re: can't create index with 'dowcast' row |
Дата | |
Msg-id | 315820.88142.qm@web32107.mail.mud.yahoo.com обсуждение исходный текст |
Ответ на | can't create index with 'dowcast' row (Louis-David Mitterrand <vindex+lists-pgsql-general@apartia.org>) |
Список | pgsql-general |
Louis what if you create one "wrapper" function immutable? some thing like this. CREATE OR REPLACE FUNCTION myextract(timestamp ) RETURNS date AS $BODY$ BEGIN return extract(date from $1) ; END; $BODY$ LANGUAGE 'plpgsql' IMMUTABLE best regards mdc --- Louis-David Mitterrand <vindex+lists-pgsql-general@apartia.org> escribió: > Hi, > > To constraint unique'ness of my visitors to a 24h > periode I tried > created a index including the 'date' part of the > created_on timestamp: > > CREATE UNIQUE INDEX visit_idx ON visit_buffer USING > btree (id_session, > id_story, created_on::date); > > psql:visit_pkey.sql:5: ERROR: syntax error at or > near "::" > LINE 1: ...buffer USING btree (id_session, > id_story, created_on::date); > > and this: > > CREATE UNIQUE INDEX visit_idx ON visit_buffer USING > btree (id_session, id_story, extract(date from > created_on)); > psql:visit_pkey.sql:4: ERROR: functions in index > expression must be marked IMMUTABLE > > How can I achieve what I am trying? > > Thanks, > > ---------------------------(end of > broadcast)--------------------------- > TIP 6: explain analyze is your friend > Yahoo! Encuentros. Ahora encontrar pareja es mucho más fácil, probá el nuevo Yahoo! Encuentros http://yahoo.cupidovirtual.com/servlet/NewRegistration
В списке pgsql-general по дате отправления: