From: | "Nico Callewaert" <callewaert(dot)nico(at)telenet(dot)be> |
---|---|
To: | "Andreas Kretschmer" <akretschmer(at)spamfence(dot)net>, <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Function call |
Date: | 2009-01-24 14:29:31 |
Message-ID: | A5F785E639474B96B9F2975DDC8CE8AB@etsinformatics.local |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
> Nico Callewaert <callewaert(dot)nico(at)telenet(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Kretschmer | 2009-01-24 15:38:48 | Re: Function call |
Previous Message | Andreas Kretschmer | 2009-01-24 14:13:50 | Re: Function call |