If it's not possible, can I create a function that gets a RECORD and a
tablename and returns the correct value. For example:

CREATE FUNCTION my_value(TEXT, RECORD) RETURNS TEXT AS '
  DECLARE
    table_name ALIAS FOR $1
    rec ALIAS FOR $2
  BEGIN
    IF (table_name = 'my_table1') THEN
      RETURN rec.my1_field;
    ELSIF (table_name = 'my_table2') THEN
      RETURN rec.my2.field;
    ...
  END;
' LANGUAGE plpgsql;

Em Ter, 2005-05-03 ās 11:52, Tom Lane escreveu:
> Ricardo Vaz Mannrich <[EMAIL PROTECTED]> writes:
> > Is it possible?
> 
> Not in plpgsql.  I believe you could do it in any of the other PLs though.
> 
>                       regards, tom lane
-- 
Ricardo Vaz Mannrich <[EMAIL PROTECTED]>


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to