Re: passing strings to functions - Mailing list pgsql-general

From Tom Lane
Subject Re: passing strings to functions
Date
Msg-id 14799.1084190180@sss.pgh.pa.us
Whole thread Raw
In response to passing strings to functions  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
List pgsql-general
Ivan Sergio Borgonovo <mail@webthatworks.it> writes:
> I can't understand how to pass strings to functions.

Your problem isn't with the strings, it's with the smallint parameter.
The undecorated "1" is an integer not a smallint, and it won't be
silently cast in this particular scenario.

> Is there a simpler way than casting everytime?

I'd suggest declaring the function to take integer.  If you really want
the rowtype to use smallint then you can cast internally.

            regards, tom lane

pgsql-general by date:

Previous
From: Shridhar Daithankar
Date:
Subject: Re: Cancel query based on a timeout
Next
From: Tom Lane
Date:
Subject: Re: Cancel query based on a timeout