[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Upgrade error
- Subject: Re: Upgrade error
- From: "G. Net" <..hidden..>
- Date: Sun, 12 Nov 2006 01:40:51 +0000 (GMT)
> Here is what we can do to make this minimally operational:
>
> go into the sql/Pg-upgrade-2.6.18-2.6.19.sql file and copy everything
> below the rules which add the items into transactions (i.e. the
> custom_table_catalog definition and the like).
>
> Basically run every command other than those create rules and insert
> commands. Then make sure that the line in Form.pm whcih sets
> {dbversion} i set to 2.6.19.
you mean the stuff copied below? maybe my mistake but if not, it didnt seem to work:
DBD::Pg::st execute failed: ERROR: permission denied for relation custom_table_catalog
DBD::Pg::st fetchrow_hashref failed: no statement executing
DBD::Pg::st execute failed: ERROR: value "7044657128191375885" is out of range for type integer
Error! Looking for session:
ERROR: value "7044657128191375885" is out of range for type integer
------
CREATE TABLE custom_table_catalog (
table_id SERIAL PRIMARY KEY,
extends TEXT,
table_name TEXT
);
CREATE TABLE custom_field_catalog (
field_id SERIAL PRIMARY KEY,
table_id INT REFERENCES custom_table_catalog,
field_name TEXT
);
CREATE OR REPLACE FUNCTION add_custom_field (VARCHAR, VARCHAR, VARCHAR)
RETURNS BOOL AS
'
DECLARE
table_name ALIAS FOR $1;
new_field_name ALIAS FOR $2;
field_datatype ALIAS FOR $3;
BEGIN
EXECUTE ''SELECT TABLE_ID FROM custom_table_catalog
WHERE extends = '''''' || table_name || '''''' '';
IF NOT FOUND THEN
BEGIN
INSERT INTO custom_table_catalog (extends) VALUES (table_name);
EXECUTE ''CREATE TABLE custom_''||table_name ||
'' (row_id INT)'';
EXCEPTION WHEN duplicate_table THEN
-- do nothing
END;
END IF;
EXECUTE ''INSERT INTO custom_field_catalog (field_name, table_id)
VALUES ( '''''' || new_field_name ||'''''', (SELECT table_id FROM custom_table_catalog
WHERE extends = ''''''|| table_name || ''''''))'';
EXECUTE ''ALTER TABLE custom_''||table_name || '' ADD COLUMN ''
|| new_field_name || '' '' || field_datatype;
RETURN TRUE;
END;
' LANGUAGE PLPGSQL;
-- end function
CREATE OR REPLACE FUNCTION drop_custom_field (VARCHAR, VARCHAR)
RETURNS BOOL AS
'
DECLARE
table_name ALIAS FOR $1;
custom_field_name ALIAS FOR $2;
BEGIN
DELETE FROM custom_field_catalog
WHERE field_name = custom_field_name AND
table_id = (SELECT table_id FROM custom_table_catalog
WHERE extends = table_name);
EXECUTE ''ALTER TABLE custom_'' || table_name ||
'' DROP COLUMN '' || custom_field_name;
RETURN TRUE;
END;
' LANGUAGE PLPGSQL;
-- end function
UPDATE defaults SET version = '2.6.18';