Re: Function call - Mailing list pgsql-novice

From Nico Callewaert
Subject Re: Function call
Date
Msg-id A5F785E639474B96B9F2975DDC8CE8AB@etsinformatics.local
Whole thread Raw
In response to Function call  ("Nico Callewaert" <callewaert.nico@telenet.be>)
Responses Re: Function call  (Andreas Kretschmer <akretschmer@spamfence.net>)
List pgsql-novice
> Nico Callewaert <callewaert.nico@telenet.be> schrieb:
>
>> Hi again,
>>
>> I tried your solution, but it gives me still the same error message.  But
>> there is a dotted line under the funcion name, like the error is pointing
>> to
>> the function name.  Is that the correct way to execute a function, using
>> SELECT ?
>
> Sorry, you should also cast the 1 to smallint:
>
> test=# CREATE OR REPLACE FUNCTION upd_afdeling(update_type text, in_afd_id
> smallint, in_afd_omschrijving text, in_date_changed timestamp without time
> zone) RETURNS integer AS $BODY$ BEGIN return 1; END; $BODY$ LANGUAGE
> plpgsql VOLATILE COST 100;
> CREATE FUNCTION
> Zeit: 0,607 ms
> test=*# select upd_afdeling('I'::text, 1::smallint, 'afdeling 1'::text,
> current_timestamp::timestamp);
> upd_afdeling
> --------------
>            1


Hello again,

This is working ! Thanks...
Is it better to use varchar as parameter, or just "text" ?  The colmuns I'm
updating through this function are varchars.
I'm still surprised about 1 thing : it seems PostgreSQL is not checking for
existing tables or columns.

Like this :         UPDATE tbl_table_last_change
            SET last_user = current_user,

Table tbl_table_last_change doesn't exist yet, but still postgreSQL is
acception the function definition...
So, I guess, there is no early checking on tables/fields ?

Thanks for your help, for sure I would never find the solution, I had no
idea about the casting...

Best regards, Nico



pgsql-novice by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Function call
Next
From: Andreas Kretschmer
Date:
Subject: Re: Function call