Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

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


  • From: marcelo Cortez <jmdc_marcelo(at)yahoo(dot)com(dot)ar>
  • To: marcelo Cortez <jmdc_marcelo(at)yahoo(dot)com(dot)ar>, Louis-David Mitterrand <vindex+lists-pgsql-general(at)apartia(dot)org>, pgsql-general(at)postgresql(dot)org
  • Subject: Re: can't create index with 'dowcast' row
  • Date: Thu, 24 Jan 2008 14:55:15 -0300 (ART)
  • Message-id: <345304(dot)5676(dot)qm(at)web32107(dot)mail(dot)mud(dot)yahoo(dot)com>

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(at)apartia(dot)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 



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group