From: | ohp(at)pyrenet(dot)fr |
---|---|
To: | pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org> |
Subject: | misread release notes |
Date: | 2007-02-06 16:35:55 |
Message-ID: | Pine.UW2.4.53.0702061723550.19801@sun.pyrenet |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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(at)pyrenet(dot)fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2007-02-06 16:43:24 | Re: Modifying and solidifying contrib |
Previous Message | Tom Lane | 2007-02-06 16:31:00 | Re: Type casting bug in 8.1.[67]? |