Re: Declaring constants in SQL - Mailing list pgsql-general

From Erwin Brandstetter
Subject Re: Declaring constants in SQL
Date
Msg-id e7522359-ba65-4a12-b9ff-027f5a5c0768@c65g2000hsa.googlegroups.com
Whole thread Raw
In response to Declaring constants in SQL  ("EXT-Rothermel, Peter M" <Peter.M.Rothermel@boeing.com>)
List pgsql-general
The last part got scrambled, should read like this:

(...)
Use it like this:
SELECT * FROM foo WHERE foo_id > myval();

Or, for the case at hand, an example in sql:

CREATE FUNCTION my_colors()
  RETURNS text[] AS
$$ SELECT ARRAY['red','green','blue'] $$
  LANGUAGE 'sql' IMMUTABLE;

Use it like this:
SELECT * FROM foo WHERE color = ANY(my_colors());

Regards
Erwin

pgsql-general by date:

Previous
From: Erwin Brandstetter
Date:
Subject: Re: Declaring constants in SQL
Next
From: Ivan Sergio Borgonovo
Date:
Subject: Re: eliminating records not in (select id ... so SLOW?