Unless your function parameter is an integer you must quote it... eq:

select use_two_tables('tablename');


Hrm... That does not work either:


# select use_two_tables('tablename');
ERROR: function use_two_tables("unknown") does not exist
HINT: No function matches the given name and argument types. You may need to add explicit type casts.
# select use_two_tables('tablename'::text);
ERROR: function use_two_tables(text) does not exist
HINT: No function matches the given name and argument types. You may need to add explicit type casts.



I am not really sure... just learning this, but I believe the parameter type is tablename, right?


CREATE TABLE tablename( ...

CREATE or REPLACE FUNCTION use_two_tables(tablename) RETURNS text AS ' ...

Do I need to cast the string to something?


# \df use_two*
                       List of functions
Result data type | Schema |      Name      | Argument data types
------------------+--------+----------------+---------------------
text             | lee    | use_two_tables | tablename
(1 row)

# select use_two_tables('tablename'::tablename);
ERROR:  cannot cast type "unknown" to tablename
# select use_two_tables(tablename::tablename);
ERROR:  column "tablename" does not exist

Thanks for your help.

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus



---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to