[SQL] Function ROWTYPE Parameter with NEW/OLD

2003-11-18 Thread Andrew Milne
Postgres 7.2.1 I'm trying to create a function that takes a ROWTYPE parameter that I can then call from a rule by passing NEW/OLD, but am having problems. CREATE OR REPLACE FUNCTION "some_boolean_function" (mytablename) RETURNS boolean AS ' DECLARE mytable ALIAS FOR $1;

[SQL] Unique Constraint Based on Date Range

2003-09-20 Thread Andrew Milne
I'm looking to apply a unique constraint to a table such that field A must be unique based on the date range from Field B to Field C. This is for a rate based service model whereby, for example, $5 is worth 1 hour of Internet access. But next week, because of increased competition, $5 is wort