misread release notes
misread release notes
От:
ohp@pyrenet.fr
Дата:
Hi all, Methinks I made a big mistake when swapping from 8.2.1 to 8.2.2 I read the "fix incorrect permission check in information_schema_key_column_usage_view" chapter in HISTORY far too fast and fed psql on each database with share/information_schema.sql. Too late to stop it! What did I do wrong, and how can I go backwards (I imagine %I broke something!) Unrelated, I have problem with conforming string: adding a E is easy in C or PHP but SpamAssassin has this plpgsql function : CREATE OR REPLACE FUNCTION put_tokens(inuserid INTEGER, intokenary BYTEA[], inspam_count INTEGER, inham_count INTEGER, inatime INTEGER) RETURNS VOID AS ' DECLARE _token BYTEA; new_tokens INTEGER := 0; BEGIN for i in array_lower(intokenary, 1) .. array_upper(intokenary, 1) LOOP _token := intokenary[i]; UPDATE bayes_token SET spam_count = greatest_int(spam_count + inspam_count, 0), ham_count = greatest_int(ham_count + inham_count, 0), atime = greatest_int(atime, inatime) WHERE id = inuserid AND token = _token; IF NOT FOUND THEN -- we do not insert negative counts, just return true IF NOT (inspam_count < 0 OR inham_count < 0) THEN INSERT INTO bayes_token (id, token, spam_count, ham_count, atime) VALUES (inuserid, _token, inspam_count, inham_count, inatime); IF FOUND THEN new_tokens := new_tokens + 1; END IF; END IF; END IF; END LOOP; IF new_tokens > 0 AND inatime > 0 THEN UPDATE bayes_vars SET token_count = token_count + new_tokens, newest_token_age = greatest_int(newest_token_age, inatime), oldest_token_age = least_int(oldest_token_age, inatime) WHERE id = inuserid; ELSEIF new_tokens > 0 AND NOT inatime > 0 THEN UPDATE bayes_vars SET token_count = token_count + new_tokens WHERE id = inuserid; ELSEIF NOT new_tokens > 0 AND inatime > 0 THEN UPDATE bayes_vars SET newest_token_age = greatest_int(newest_token_age, inatime), oldest_token_age = least_int(oldest_token_age, inatime) WHERE id = inuserid; END IF; RETURN; END; ' LANGUAGE 'plpgsql'; As you see, token is bytea where do I put the E in the insert query? Keep the good job! Regards -- Olivier PRENANT Tel: +33-5-61-50-97-00 (Work) 15, Chemin des Monges +33-5-61-50-97-01 (Fax) 31190 AUTERIVE +33-6-07-63-80-64 (GSM) FRANCE Email: ohp@pyrenet.fr ------------------------------------------------------------------------------ Make your life a dream, make your dream a reality. (St Exupery)
Re: misread release notes
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
ohp@pyrenet.fr writes: > I read the "fix incorrect permission check in > information_schema_key_column_usage_view" chapter in HISTORY far too fast > and fed psql on each database with share/information_schema.sql. > Too late to stop it! > What did I do wrong, and how can I go backwards (I imagine %I broke > something!) I don't think you changed anything --- none of the commands say OR REPLACE so they'd just all fail. regards, tom lane
Re: misread release notes
От:
Andrew Dunstan <andrew@dunslane.net>
Дата:
ohp@pyrenet.fr wrote: > Unrelated, I have problem with conforming string: adding a E is easy in C > or PHP but SpamAssassin has this plpgsql function : > > > [snip] > As you see, token is bytea where do I put the E in the insert query? > > Since you aren't using a string literal in this function for token or anything else, AFAICS, I don't understand why you would need to. cheers andrew
Re: misread release notes
От:
ohp@pyrenet.fr
Дата:
Hi Tom, On Tue, 6 Feb 2007, Tom Lane wrote: > Date: Tue, 06 Feb 2007 11:50:56 -0500 > From: Tom Lane > To: ohp@pyrenet.fr > Cc: pgsql-hackers list > Subject: Re: [HACKERS] misread release notes > > ohp@pyrenet.fr writes: > > I read the "fix incorrect permission check in > > information_schema_key_column_usage_view" chapter in HISTORY far too fast > > and fed psql on each database with share/information_schema.sql. > > Too late to stop it! > > What did I do wrong, and how can I go backwards (I imagine %I broke > > something!) > > I don't think you changed anything --- none of the commands say OR REPLACE > so they'd just all fail. Yes but I saw a lot of inserts... > > regards, tom lane > -- Olivier PRENANT Tel: +33-5-61-50-97-00 (Work) 15, Chemin des Monges +33-5-61-50-97-01 (Fax) 31190 AUTERIVE +33-6-07-63-80-64 (GSM) FRANCE Email: ohp@pyrenet.fr ------------------------------------------------------------------------------ Make your life a dream, make your dream a reality. (St Exupery)