Re: [GENERAL] can't create index with 'dowcast' row

2008-01-26 Thread Louis-David Mitterrand
On Fri, Jan 25, 2008 at 12:17:16AM -0500, Tom Lane wrote: > Louis-David Mitterrand <[EMAIL PROTECTED]> writes: > > 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 "::"

Re: [GENERAL] can't create index with 'dowcast' row

2008-01-24 Thread Tom Lane
Louis-David Mitterrand <[EMAIL PROTECTED]> writes: > 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 "::" The reason that didn't work is that you need parentheses arou

Re: [GENERAL] can't create index with 'dowcast' row

2008-01-24 Thread marcelo Cortez
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 ) >

Re: [GENERAL] can't create index with 'dowcast' row

2008-01-24 Thread marcelo Cortez
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