我正在研究地理处理软件中的数据库并遇到了一些问题。有必要在这个数据库中创建一个额外的层,我也决定尝试创建它。
使用 pgAdmin 4 软件、PostgreSQL 10.1 和 postgis 10。我在我为在数据库中创建这一层而编写的行下方提交。
我设法创建了图层,一切正常,出现字段,出现每列的选项,但问题是:我需要administracao
andclasseativecon
列接受多个元素,而不仅仅是一个。例如,在admin层,我想放代码2和3,但只接受一个。
我认为这是一件简单的事情,但由于我的知识几乎为零,我做不到。我希望你能帮助我。
CREATE TABLE ge.edf_edificacao_pavimento_a (
id integer NOT NULL DEFAULT nextval('ge.edf_edificacao_pavimento_a_id_seq'::regclass),
geometriaaproximada smallint NOT NULL DEFAULT 0,
nome smallint NOT NULL,
numero smallint NOT NULL,
bloco smallint NOT NULL,
operacional smallint NOT NULL,
situacaofisica smallint NOT NULL DEFAULT 95,
matconstr smallint NOT NULL,
numeropavimentos smallint NOT NULL,
alturaaproximada smallint NOT NULL,
turistica smallint NOT NULL,
cultura smallint NOT NULL,
administracao smallint NOT NULL,
classeativecon smallint NOT NULL,
divisaoativecon smallint NOT NULL,
grupoativecon smallint NOT NULL,
proprioadm smallint NOT NULL,
numerosequencial smallint NOT NULL,
numerometrico smallint NOT NULL,
cep smallint NOT NULL,
pais smallint NOT NULL,
unidadefederacao smallint NOT NULL,
municipio smallint NOT NULL,
bairro smallint NOT NULL,
logradoura smallint NOT NULL,
id_assentamento_precario smallint NOT NULL,
id_complexo_habitacional smallint NOT NULL,
geom geometry(MultiPolygon,31984) NOT NULL,
CONSTRAINT edf_edificacao_pavimento_a_pk PRIMARY KEY (id)
WITH (FILLFACTOR=10),
CONSTRAINT edf_edificacao_pavimento_a_turistica_fk FOREIGN KEY (turistica)
REFERENCES dominios.booleano_estendido (code) MATCH FULL,
CONSTRAINT edf_edificacao_pavimento_a_situacaofisica_fk FOREIGN KEY (situacaofisica)
REFERENCES dominios.situacao_fisica (code) MATCH FULL,
CONSTRAINT edf_edificacao_pavimento_a_proprioadm_fk FOREIGN KEY (proprioadm)
REFERENCES dominios.booleano (code) MATCH FULL,
CONSTRAINT edf_edificacao_pavimento_a_operacional_fk FOREIGN KEY (operacional)
REFERENCES dominios.booleano_estendido (code) MATCH FULL,
CONSTRAINT edf_edificacao_pavimento_a_matconstr_fk FOREIGN KEY (matconstr)
REFERENCES dominios.mat_constr (code) MATCH FULL,
CONSTRAINT edf_edificacao_pavimento_a_grupoativecon_fk FOREIGN KEY (grupoativecon)
REFERENCES dominios.grupo_ativ_econ (code) MATCH FULL,
CONSTRAINT edf_edificacao_pavimento_a_geometriaaproximada_fk FOREIGN KEY (geometriaaproximada)
REFERENCES dominios.booleano (code) MATCH FULL,
CONSTRAINT edf_edificacao_pavimento_a_divisaoativecon_fk FOREIGN KEY (divisaoativecon)
REFERENCES dominios.divisao_ativ_econ (code) MATCH FULL,
CONSTRAINT edf_edificacao_pavimento_a_cultura_fk FOREIGN KEY (cultura)
REFERENCES dominios.booleano_estendido (code) MATCH FULL,
CONSTRAINT edf_edificacao_pavimento_a_classeativecon_fk FOREIGN KEY (classeativecon)
REFERENCES dominios.classe_ativ_econ (code) MATCH FULL,
CONSTRAINT edf_edificacao_pavimento_a_administracao_fk FOREIGN KEY (administracao)
REFERENCES dominios.administracao (code) MATCH FULL,
CONSTRAINT edf_edificacao_a_administracao_check CHECK (administracao = ANY (ARRAY[(2)::smallint, (3)::smallint, (4)::smallint, (5)::smallint, (6)::smallint, (95)::smallint, (97)::smallint])),
CONSTRAINT edf_edificacao_a_classeativecon_check CHECK (classeativecon = ANY (ARRAY[(10)::smallint, (11)::smallint, (12)::smallint, (13)::smallint, (14)::smallint, (15)::smallint, (16)::smallint, (17)::smallint, (18)::smallint, (19)::smallint, (2)::smallint, (20)::smallint, (21)::smallint, (22)::smallint, (23)::smallint, (24)::smallint, (25)::smallint, (26)::smallint, (27)::smallint, (28)::smallint, (29)::smallint, (3)::smallint, (30)::smallint, (31)::smallint, (32)::smallint, (33)::smallint, (34)::smallint, (35)::smallint, (36)::smallint, (4)::smallint, (5)::smallint, (6)::smallint, (7)::smallint, (8)::smallint, (9)::smallint, (95)::smallint, (98)::smallint, (99)::smallint])),
CONSTRAINT edf_edificacao_a_cultura_check CHECK (cultura = ANY (ARRAY[(0)::smallint, (1)::smallint, (95)::smallint])),
CONSTRAINT edf_edificacao_a_divisaoativecon_check CHECK (divisaoativecon = ANY (ARRAY[(1)::smallint, (10)::smallint, (11)::smallint, (13)::smallint, (14)::smallint, (15)::smallint, (16)::smallint, (17)::smallint, (18)::smallint, (19)::smallint, (2)::smallint, (20)::smallint, (21)::smallint, (22)::smallint, (23)::smallint, (24)::smallint, (25)::smallint, (27)::smallint, (28)::smallint, (29)::smallint, (30)::smallint, (31)::smallint, (32)::smallint, (33)::smallint, (34)::smallint, (35)::smallint, (36)::smallint, (37)::smallint, (45)::smallint, (5)::smallint, (50)::smallint, (51)::smallint, (52)::smallint, (55)::smallint, (74)::smallint, (92)::smallint, (95)::smallint, (99)::smallint])),
CONSTRAINT edf_edificacao_a_geometriaaproximada_check CHECK (geometriaaproximada = ANY (ARRAY[(0)::smallint, (1)::smallint])),
CONSTRAINT edf_edificacao_a_grupoativecon_check CHECK (grupoativecon = ANY (ARRAY[(15)::smallint, (16)::smallint, (19)::smallint, (20)::smallint, (23)::smallint, (30)::smallint, (31)::smallint, (32)::smallint, (6)::smallint, (8)::smallint, (95)::smallint, (98)::smallint, (99)::smallint])),
CONSTRAINT edf_edificacao_a_matconstr_check CHECK (matconstr = ANY (ARRAY[(1)::smallint, (2)::smallint, (3)::smallint, (5)::smallint, (8)::smallint, (95)::smallint, (97)::smallint, (99)::smallint])),
CONSTRAINT edf_edificacao_a_operacional_check CHECK (operacional = ANY (ARRAY[(0)::smallint, (1)::smallint, (95)::smallint])),
CONSTRAINT edf_edificacao_a_proprioadm_check CHECK (proprioadm = ANY (ARRAY[(0)::smallint, (1)::smallint])),
CONSTRAINT edf_edificacao_a_situacaofisica_check CHECK (situacaofisica = ANY (ARRAY[(1)::smallint, (2)::smallint, (3)::smallint, (4)::smallint, (5)::smallint, (7)::smallint, (95)::smallint, (97)::smallint])),
CONSTRAINT edf_edificacao_a_turistica_check CHECK (turistica = ANY (ARRAY[(0)::smallint, (1)::smallint, (95)::smallint]))
);
CREATE INDEX edf_edificacao_pavimento_a_gist
ON ge.edf_edificacao_pavimento_a USING gist (geom);