I need to change a data type in a table, but run into a dependency error. Is possible to change the data type of an INTEGER
column to NUMERIC
directly in pg_attribute?
I've tried with ALTER TABLE
and it does not work:
CREATE TABLE documento (
iddocumento SERIAL,
idtipodocumento INTEGER NOT NULL,
folio INTEGER NOT NULL,
CONSTRAINT pk_documento PRIMARY KEY(iddocumento)
);
ALTER TABLE documento ALTER COLUMN folio TYPE NUMERIC(10,0);
The error:
ERROR: cannot alter type of a column used by a view or rule
DETAIL: rule _RETURN on view vw_xxx depends on column "folio"
The column has many dependencies.
Try with this:
DROP DROP DROP
ALTER TABLE documento ALTER COLUMN folio TYPE NUMERIC(10,0);
CREATE CREATE CREATE...
Sure works fine