15 |
-- PostgreSQL database dump |
-- PostgreSQL database dump |
16 |
-- |
-- |
17 |
|
|
|
CREATE SCHEMA openads; |
|
|
|
|
|
|
|
|
SET search_path = openads, pg_catalog; |
|
|
|
|
|
-- |
|
|
-- Name: fn_fixsequences(); Type: FUNCTION; Schema: openads; Owner: - |
|
|
-- |
|
|
|
|
|
CREATE FUNCTION fn_fixsequences() RETURNS integer |
|
|
LANGUAGE plpgsql |
|
|
AS $$ |
|
|
DECLARE |
|
|
themax BIGINT; |
|
|
mytables RECORD; |
|
|
num integer; |
|
|
BEGIN |
|
|
num := 0; |
|
|
FOR mytables IN |
|
|
SELECT S.relname as seq, C.attname as attname, T.relname as relname |
|
|
FROM pg_class AS S, pg_depend AS D, pg_class AS T, pg_attribute AS C |
|
|
WHERE S.relkind = 'S' |
|
|
AND S.oid = D.objid |
|
|
AND D.refobjid = T.oid |
|
|
AND D.refobjid = C.attrelid |
|
|
AND D.refobjsubid = C.attnum |
|
|
LOOP |
|
|
EXECUTE 'SELECT MAX('||mytables.attname||') FROM '||mytables.relname||';' INTO themax; |
|
|
IF (themax is null OR themax < 0) THEN |
|
|
themax := 0; |
|
|
END IF; |
|
|
themax := themax +1; |
|
|
EXECUTE 'ALTER SEQUENCE ' || mytables.seq || ' RESTART WITH '||themax; |
|
|
num := num + 1; |
|
|
END LOOP; |
|
|
|
|
|
RETURN num; |
|
|
|
|
|
END; |
|
|
$$; |
|
|
|
|
|
|
|
|
SET default_tablespace = ''; |
|
|
|
|
|
SET default_with_oids = false; |
|
|
|
|
18 |
-- |
-- |
19 |
-- Name: action; Type: TABLE; Schema: openads; Owner: -; Tablespace: |
-- Name: action; Type: TABLE; Schema: openads; Owner: -; Tablespace: |
20 |
-- |
-- |
1575 |
etat_pendant_incompletude character varying(20), |
etat_pendant_incompletude character varying(20), |
1576 |
date_limite_incompletude date, |
date_limite_incompletude date, |
1577 |
delai_incompletude integer, |
delai_incompletude integer, |
1578 |
geom public.geometry(Point,2154), |
geom text, |
1579 |
geom1 public.geometry(MultiPolygon,2154) |
geom1 text |
1580 |
); |
); |
1581 |
|
|
1582 |
|
|
2503 |
surface double precision, |
surface double precision, |
2504 |
section character varying(7), |
section character varying(7), |
2505 |
commune character varying(5), |
commune character varying(5), |
2506 |
geom public.geometry(Polygon,2154) |
geom text |
2507 |
); |
); |
2508 |
|
|
2509 |
|
|
2518 |
lotissement character varying(50) NOT NULL, |
lotissement character varying(50) NOT NULL, |
2519 |
numero character varying(16), |
numero character varying(16), |
2520 |
surface numeric(10,3), |
surface numeric(10,3), |
2521 |
geom public.geometry(Polygon,2154) |
geom text |
2522 |
); |
); |
2523 |
|
|
2524 |
|
|
2548 |
CREATE TABLE pos ( |
CREATE TABLE pos ( |
2549 |
pos character varying(10) NOT NULL, |
pos character varying(10) NOT NULL, |
2550 |
libelle character varying(40) NOT NULL, |
libelle character varying(40) NOT NULL, |
2551 |
geom public.geometry(Polygon,2154) |
geom text |
2552 |
); |
); |
2553 |
|
|
2554 |
|
|
2759 |
observation character varying(80), |
observation character varying(80), |
2760 |
perimetre integer, |
perimetre integer, |
2761 |
description text, |
description text, |
2762 |
geom public.geometry(LineString,2154) |
geom text |
2763 |
); |
); |
2764 |
|
|
2765 |
|
|
2792 |
observation character varying(80), |
observation character varying(80), |
2793 |
perimetre integer, |
perimetre integer, |
2794 |
description text, |
description text, |
2795 |
geom public.geometry(Point,2154) |
geom text |
2796 |
); |
); |
2797 |
|
|
2798 |
|
|
2825 |
observation character varying(80), |
observation character varying(80), |
2826 |
perimetre integer, |
perimetre integer, |
2827 |
description text, |
description text, |
2828 |
geom public.geometry(Polygon,2154) |
geom text |
2829 |
); |
); |
2830 |
|
|
2831 |
|
|