Re: [GENERAL] Declaring constants in SQL

2008-07-31 Thread Erwin Brandstetter
On Jul 30, 10:53 pm, [EMAIL PROTECTED] (Richard Broersma) wrote: On Wed, Jul 30, 2008 at 1:16 PM, EXT-Rothermel, Peter M [EMAIL PROTECTED] wrote: Is there any means like (#define or DECLARE ) where I can write SQL like (...) CREATE VIEW primary_colors_foos AS   SELECT * FROM foo    WHERE

Re: [GENERAL] Declaring constants in SQL

2008-07-31 Thread Erwin Brandstetter
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

[GENERAL] Declaring constants in SQL

2008-07-30 Thread EXT-Rothermel, Peter M
Let's say I have a table foo with a column color where the color column is defined as an integer but in my application space is an enumeration: Table public.foo Column |Type | Modifiers

Re: [GENERAL] Declaring constants in SQL

2008-07-30 Thread Richard Broersma
On Wed, Jul 30, 2008 at 1:16 PM, EXT-Rothermel, Peter M [EMAIL PROTECTED] wrote: Is there any means like (#define or DECLARE ) where I can write SQL like this: CREATE VIEW primary_colors_foos AS SELECT * from foo WHERE ( color = FOO_COLOR_RED OR color = FOO_COLOR_BLUE OR color =