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 "::"
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
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 )
>
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