Re: [SQL] const cast ?

2001-02-02 Thread Tom Lane
Michael Fork <[EMAIL PROTECTED]> writes: > You can create a function with the IsCacheable attribute... > CREATE FUNCTION my_date_part(date) RETURNS int4 AS ' > SELECT date_part('year', $1); > ' LANGUAGE 'sql' WITH iscachable(); The reason date_part --- and most other datetime-related functi

Re: [SQL] const cast ?

2001-02-02 Thread Michael Fork
You can create a function with the IsCacheable attribute... CREATE FUNCTION my_date_part(date) RETURNS int4 AS ' SELECT date_part('year', $1); ' LANGUAGE 'sql' WITH iscachable(); (This can be found in the create function docs, or in Bruce's book -- both available on the website) Michael

RE: [SQL] const cast ?

2001-02-02 Thread Michael Ansley
Title: RE: [SQL] const cast ? The problem is that there is no way of determining whether or not the sort order after the function has been executed will be the same as the sort order on the raw data.  For example, the sort order of n (-10..10) is very different to the sort order of abs(n