Unix Technical Forum

Re: can't create index with 'dowcast' row

This is a discussion on Re: can't create index with 'dowcast' row within the Pgsql General forums, part of the PostgreSQL category; --> Sorry forgot to mention later try CREATE UNIQUE INDEX visit_idx ON visit_buffer( id_session, id_story ,myextract(created_on)); best regards > Louis ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 12:19 AM
marcelo Cortez
 
Posts: n/a
Default Re: can't create index with 'dowcast' row

Sorry forgot to mention

later try

CREATE UNIQUE INDEX visit_idx ON visit_buffer(
id_session, id_story ,myextract(created_on));


best regards

> 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
>




Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. www.tuprimeratarjeta.com.ar

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:54 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com