Bonjour,

Je cale toujours sur le même problème Pourtant j’ai appliqué le même script que dans une autre discussion ?

Voilà je souhaite copier une colonne (juste une pour commencer) -op_placename- d’une table -observation_places- dans une autre table -obs_places_station- uniquement pour les lignes où elles ont le nom en commun, soit observation_places.op_placename = obs_places_station.toponyme

La colonne op_placename de obs_places_station est vide pour l'instant.

(L’idée est après d’enlever la colonne toponyme et de faire hériter la table obs_places_station de la table observation_places..)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
CREATE TABLE bdsat.obs_places_station
(
  id_s integer NOT NULL DEFAULT nextval('bdsat.discomi_saumon_gid_seq'::regclass),
  op_gislocation2 character varying(10),
  xl93 double precision,
  yl93 double precision,
  toponyme character varying(255),
  type_station character varying(70),
  "operator" character varying(50),
  river character varying(50),
  date character varying(10),
  the_geom geometry,
  op_id uuid,
  op_gis_systemname character varying(20),
  op_gis_layername character varying(30),
  op_gislocation character varying(15),
  op_placename character varying(255),
  op_no_observationplacetype integer,
  CONSTRAINT discomi_saumon_pkey PRIMARY KEY (id_s),
  CONSTRAINT enforce_dims_the_geom CHECK (st_ndims(the_geom) = 2),
  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL),
  CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 2154)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE bdsat.obs_places_station OWNER TO postgres;
 
 
CREATE TABLE bdsat.observation_places
(
  op_id uuid NOT NULL DEFAULT uuid_generate_v4(),
  op_gis_systemname character varying(20),
  op_gis_layername character varying(30),
  op_gislocation character varying(25),
  op_placename character varying(255),
  op_no_observationplacetype integer,
  CONSTRAINT observation_places_pkey PRIMARY KEY (op_id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE bdsat.observation_places OWNER TO postgres;
Ma requête est donc:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
UPDATE bdsat.obs_places_station
INNER JOIN bdsat.observation_places ON obs_places_station.toponyme = observation_places.op_placename
SET obs_places_station.op_placename = observation_places.op_placename
WHERE obs_places_station.op_placename IS NULL
Le message affiché est erreur de syntaxe sur le SELECT mais je ne vois pas d’où cela peut provenir…