pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Moritz Bayer <moritz.bayer@googlemail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Problem with self-made plpgsql-function / casting
Date: Sat, 20 Aug 2005 18:04:06 +0200
Message-ID: <c244500b0508200904311f10cc@mail.gmail.com> (raw)
In-Reply-To: <24394.1124553118@sss.pgh.pa.us>
References: <c244500b0508200754193958c7@mail.gmail.com>
<24394.1124553118@sss.pgh.pa.us>
That's it!!!
Thanks a lot!
Moritz
PS: Hope some day I'll be the one to be an help for newbies! I'm working on
it!
2005/8/20, Tom Lane <tgl@sss.pgh.pa.us>:
>
> Moritz Bayer <moritz.bayer@googlemail.com> writes:
> > ERROR: function public.fc_editlanguage(integer, "unknown", "unknown",
> > integer) does not exist
> >
> > CREATE OR REPLACE FUNCTION "public"."fc_editlanguage" (id bigint, name
> > varchar, kuerzel varchar, active smallint) RETURNS smallint AS
>
> The short answer to this is to avoid declaring function arguments as
> "smallint". When you call this as, say,
>
> select fc_editlanguage(42, 'foo', 'bar', 1);
>
> the "42" and the "1" are initially typed as integer constants. There's
> an implicit up-cast from integer to bigint, so the parser has no problem
> matching the 42 to a bigint parameter, but the down-cast from integer to
> smallint is not implicit. With the function as written you'd have to
> cast to smallint explicitly:
>
> select fc_editlanguage(42, 'foo', 'bar', 1::smallint);
>
> This is enough of a notational pain in the neck that it's easier just to
> declare the argument as integer.
>
> regards, tom lane
>
--
<img src="http://ad.zanox.com/ppv/?2510394C569771607"; align="bottom"
width="1" height="1" border="0" hspace="1"><a href="
http://ad.zanox.com/ppc/?2510394C569771607T">Lenscare AG - Europas größter
Kontaktlinsenversand</a>
view thread (5+ messages)
Message-ID: <c244500b0508200904311f10cc@mail.gmail.com> Permalink: ../c244500b0508200904311f10cc@mail.gmail.com/ Also on: postgresql.org/message-id/c244500b0508200904311f10cc@mail.gmail.com ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients using the --to and --cc options: reply via email To: pgsql-sql@postgresql.org Cc: moritz.bayer@googlemail.com, tgl@sss.pgh.pa.us Subject: Re: Problem with self-made plpgsql-function / casting In-Reply-To: <c244500b0508200904311f10cc@mail.gmail.com> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox