BEGIN;

CREATE SEQUENCE dbridseq;

 CREATE TABLE ferber_rust_params
  (fbrp_id		SERIAL PRIMARY KEY,
   fbrp_pos		INTEGER,	  	
   fbrp_ferber		VARCHAR(20), --REFERENCES ferber ON UPDATE CASCADE ON DELETE CASCADE,
   fbrp_descr		VARCHAR(80) NOT NULL,
   fbrp_name		VARCHAR(10) NOT NULL,
   fbrp_default		FLOAT4,
   fbrp_formula		VARCHAR(100),
   dbrid		VARCHAR UNIQUE DEFAULT nextval('dbridseq')
  );


INSERT INTO ferber_rust_params (fbrp_id, fbrp_pos, fbrp_ferber, fbrp_descr, fbrp_name, fbrp_default, fbrp_formula, dbrid) VALUES (6, 4, 'BSRUND', 'Vorschub aus Tabelle', 'vorschub', 360, 'vorschub-(vorschub/100*40)', '337941');


SELECT * INTO TEMP TABLE ferber_rus_205102 FROM ferber_rust_params WHERE fbrp_ferber='BSRUND';
UPDATE ferber_rus_205102 SET fbrp_name='BSRUND1';
ALTER TABLE ferber_rus_205102 DROP COLUMN dbrid;
INSERT INTO ferber_rust_params SELECT * FROM ferber_rus_205102;

ROLLBACK;