Thread: how to call a function with row-type arg
hihow to call a function with a row_type arg ??that is the question CREATE FUNCTION foo(tablename) returns int ..... SELECT foo ( ??????? );
<tt>DECLARE</tt><br /><tt> I INTEGER;</tt><br /><tt>BEGIN</tt><br /><tt> SELECT *</tt><br /><tt> INTO I</tt><br/><tt> FROM foo( <</tt>tablename><tt> )</tt><p>That part is easy, but I don't understand what you areusing as a function parameter. <p>Rick <p>sad wrote: <blockquote type="CITE">hi <br /> how to call a function with a row_typearg ?? <br /> that is the question <p>CREATE FUNCTION foo(tablename) returns int ..... <p>SELECT foo ( ??????? );<p>---------------------------(end of broadcast)--------------------------- <br />TIP 7: don't forget to increase yourfree space map settings</blockquote>
sad <sad@bankir.ru> writes: > how to call a function with a row_type arg ?? > CREATE FUNCTION foo(tablename) returns int ..... SELECT foo(tablename) FROM tablename; orSELECT foo(tablename.*) FROM tablename; The first is traditional Postgres usage, but I think the second makes it more clear what's going on. BTW, if you use a table alias then the alias is the name to refer to. SELECT foo(x.*) FROM tablename as x; regards, tom lane