function cache??

Started by Janning Vygenalmost 25 years ago5 messagesgeneral
Jump to latest
#1Janning Vygen
vygen@planwerk6.de

Hi

it seems to me that function are not reloaded vene if id rop them and
recreate them.

if i restart postmaster it works fine.

I didnt find anything in the documentation. Can ybody give me a hint whats
wrong?

janning

--
Planwerk 6 /websolutions
Herzogstra�e 86
40215 D�sseldorf

fon 0211-6015919
fax 0211-6015917
http://www.planwerk6.de

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Janning Vygen (#1)
Re: function cache??

Janning Vygen <vygen@planwerk6.de> writes:

it seems to me that function are not reloaded vene if id rop them and
recreate them.

That's hard to believe. Example please?

regards, tom lane

#3Janning Vygen
vygen@planwerk6.de
In reply to: Tom Lane (#2)
Re: function cache??

Am Freitag, 29. Juni 2001 16:53 schrieb Tom Lane:

Janning Vygen <vygen@planwerk6.de> writes:

it seems to me that function are not reloaded vene if id rop them and
recreate them.

That's hard to believe. Example please?

regards, tom lane

small webpage is grabbing some contactdata.
i have a shell script which drops and recreates datatbase
and the cat the following with

cat sql_commands | psql kontaktdaten

last thing i added was the telephone check
and it seems that the backend just dont care about it.

but i do believe that i did a mistake anywhere else, os i go and search for
it.

file sql_commands

\connect - janning

CREATE TABLE kontakte (
kontakte_id serial,
empfaenger text,
anrede text,
name text,
vorname text,
email text,
telefon text,
firma text,
nachricht text,
aufmerksam text,
newsletter text
);

CREATE FUNCTION check_kontakte () RETURNS OPAQUE AS '
BEGIN

IF NEW.anrede = ''0'' THEN
NEW.anrede := NULL;
END IF;

IF NEW.aufmerksam = ''0'' THEN
NEW.aufmerksam := NULL;
END IF;

IF NEW.telefon ISNULL THEN
RAISE EXCEPTION ''Bitte geben Sie ihre Telefonnumer an'';
RETURN NULL;
END IF;
RETURN NEW;

END;
' LANGUAGE 'plpgsql';

CREATE TRIGGER if_kontakte BEFORE INSERT OR UPDATE ON kontakte
FOR EACH ROW EXECUTE PROCEDURE check_kontakte();

--
Planwerk 6 /websolutions
Herzogstra�e 86
40215 D�sseldorf

fon 0211-6015919
fax 0211-6015917
http://www.planwerk6.de

#4Janning Vygen
vygen@planwerk6.de
In reply to: Janning Vygen (#3)
Re: function cache??

I got the error seconds after i posted this message .
sorry.

I did check for NULL but it was the empty string! stupid!

sorry for this stupid question

janning

Am Freitag, 29. Juni 2001 17:14 schrieb Janning Vygen:

Am Freitag, 29. Juni 2001 16:53 schrieb Tom Lane:

Janning Vygen <vygen@planwerk6.de> writes:

it seems to me that function are not reloaded vene if id rop them and
recreate them.

That's hard to believe. Example please?

regards, tom lane

small webpage is grabbing some contactdata.
i have a shell script which drops and recreates datatbase
and the cat the following with

cat sql_commands | psql kontaktdaten

last thing i added was the telephone check
and it seems that the backend just dont care about it.

but i do believe that i did a mistake anywhere else, os i go and search for
it.

file sql_commands

\connect - janning

CREATE TABLE kontakte (
kontakte_id serial,
empfaenger text,
anrede text,
name text,
vorname text,
email text,
telefon text,
firma text,
nachricht text,
aufmerksam text,
newsletter text
);

CREATE FUNCTION check_kontakte () RETURNS OPAQUE AS '
BEGIN

IF NEW.anrede = ''0'' THEN
NEW.anrede := NULL;
END IF;

IF NEW.aufmerksam = ''0'' THEN
NEW.aufmerksam := NULL;
END IF;

IF NEW.telefon ISNULL THEN
RAISE EXCEPTION ''Bitte geben Sie ihre Telefonnumer an'';
RETURN NULL;
END IF;
RETURN NEW;

END;
' LANGUAGE 'plpgsql';

CREATE TRIGGER if_kontakte BEFORE INSERT OR UPDATE ON kontakte
FOR EACH ROW EXECUTE PROCEDURE check_kontakte();

--
Planwerk 6 /websolutions
Herzogstra�e 86
40215 D�sseldorf

fon 0211-6015919
fax 0211-6015917
http://www.planwerk6.de

#5Jan Wieck
JanWieck@Yahoo.com
In reply to: Janning Vygen (#3)
Re: function cache??

Janning Vygen wrote:

Am Freitag, 29. Juni 2001 16:53 schrieb Tom Lane:

Janning Vygen <vygen@planwerk6.de> writes:

it seems to me that function are not reloaded vene if id rop them and
recreate them.

That's hard to believe. Example please?

regards, tom lane

small webpage is grabbing some contactdata.
i have a shell script which drops and recreates datatbase
and the cat the following with

cat sql_commands | psql kontaktdaten

last thing i added was the telephone check
and it seems that the backend just dont care about it.

but i do believe that i did a mistake anywhere else, os i go and search for
it.

file sql_commands

[...]

It's even harder to believe that a user defined function
survives a database drop/recreate. What database version are
you using?

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com