Re-use a hardcoded value in multiple function calls in PostgreSQL query -
Re-use a hardcoded value in multiple function calls in PostgreSQL query -
i have functions in postgresql 9.0 homecoming table results. thought behind these homecoming info @ time, eg.
create function person_asof(effective_time timestamp time zone) returns setof person ... create function pgroup_asof(effective_time timestamp time zone) returns setof pgroup ...
i can query them if tables, joins , all:
select * pgroup_asof('2011-01-01') g bring together person_asof('2011-01-01') p on g.id = p.group_id
this works fine, there trick can utilize specify effective time once?
i tried this:
select * (select '2010-04-12'::timestamp ts) effective, pgroup_asof(effective.ts) g bring together person_asof(effective.ts) p on g.id = p.group_id
...but fails error: function look in cannot refer other relations of same query level , putting main query sub-query doesn't help, either.
this have wanted in past not possible yet, there may hope on horizon.
postgresql sql-function
Comments
Post a Comment