Column "Default" not found

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Column "Default" not found

Rodolphe
Hi,

I am trying the method you proposed in the previous post to calculate the exposure of the population

DROP table IF EXISTS receivers_building ;
CREATE TABLE receivers_building as SELECT
ST_UPDATEZ(ST_LOCATEALONG(the_geom, 0.5, 2),4) as the_geom, ID from
BUILDINGS_DEF;

DROP TABLE if EXISTS receivers_facades;
CREATE TABLE receivers_facades(PK SERIAL, THE_GEOM GEOMETRY,ID INT) as SELECT DEFAULT, E.the_geom, E.ID
FROM ST_EXPLODE('receivers_building') E, GIP_CALC F WHERE
ST_Intersects(E.the_geom, F.the_geom) ;

drop table if exists pt_level;
create table pt_level as select * from BR_PTGRID3D('BUILDINGS_DEF',
'H_FINAL','ROADS_SRC','RECEIVERS_FACADES','DB_M','G_DEF','',750,50,2,1,0.23);

But I am obtaining this strange error:

ERROR [Thread-5477] (ExecuteScriptProcess.java:160) - Column "DEFAULT" not found; SQL statement:
CREATE TABLE receivers_facades(PK SERIAL, THE_GEOM GEOMETRY,ID INT) as SELECT DEFAULT, E.the_geom, E.ID
FROM ST_EXPLODE('receivers_building') E, GIP_CALC F WHERE
ST_Intersects(E.the_geom, F.the_geom) [42122-182]


I have tried to run the programm without the PK SERIAL, it works perfectly well but, without surprise, I am not able to assignate the facades on the buildings since I have no identifiers for it.

I have also try to add a serial after creating receivers facades using:


DROP TABLE if EXISTS receivers_facades;
CREATE TABLE receivers_facades( THE_GEOM GEOMETRY,ID INT) as SELECT E.the_geom, E.ID FROM ST_EXPLODE('receivers_building') E, GIP_CALC F WHERE ST_Intersects(E.the_geom, F.the_geom) ;
alter table receivers_facades add column numero serial;
update receivers_facades set numero =default;


The result is very strange because in the column numero I have a number serie but it starts at the value "total number of column +1" and not at 0... I haven't found anything helping me on the web. It is probably some syntax error, but I really don't get it.

Regards,
Rodolphe.
Reply | Threaded
Open this post in threaded view
|

Re: Column "Default" not found

Nicolas F.
Administrator

Hi,

Sorry, DEFAULT is for insert statements. In this case this is NULL.

You can alternatively alter table and add the serial column.

Regards,

 --

Nicolas Fortin
IRSTV FR CNRS 2488
GIS        http://orbisgis.org
Spatial DB http://h2gis.org
Noise      http://noisemap.orbisgis.org

Le 2015-03-12 10:50, Rodolphe [via OrbisGIS] a écrit :

Hi,

I am trying the method you proposed in the previous post to calculate the exposure of the population

DROP table IF EXISTS receivers_building ;
CREATE TABLE receivers_building as SELECT
ST_UPDATEZ(ST_LOCATEALONG(the_geom, 0.5, 2),4) as the_geom, ID from
BUILDINGS_DEF;

DROP TABLE if EXISTS receivers_facades;
CREATE TABLE receivers_facades(PK SERIAL, THE_GEOM GEOMETRY,ID INT) as SELECT DEFAULT, E.the_geom, E.ID
FROM ST_EXPLODE('receivers_building') E, GIP_CALC F WHERE
ST_Intersects(E.the_geom, F.the_geom) ;

drop table if exists pt_level;
create table pt_level as select * from BR_PTGRID3D('BUILDINGS_DEF',
'H_FINAL','ROADS_SRC','RECEIVERS_FACADES','DB_M','G_DEF','',750,50,2,1,0.23);

But I am obtaining this strange error:

ERROR [Thread-5477] (ExecuteScriptProcess.java:160) - Column "DEFAULT" not found; SQL statement:
CREATE TABLE receivers_facades(PK SERIAL, THE_GEOM GEOMETRY,ID INT) as SELECT DEFAULT, E.the_geom, E.ID
FROM ST_EXPLODE('receivers_building') E, GIP_CALC F WHERE
ST_Intersects(E.the_geom, F.the_geom) [42122-182]


I have tried to run the programm without the PK SERIAL, it works perfectly well but, without surprise, I am not able to assignate the facades on the buildings since I have no identifiers for it.

I have also try to add a serial after creating receivers facades using:


DROP TABLE if EXISTS receivers_facades;
CREATE TABLE receivers_facades( THE_GEOM GEOMETRY,ID INT) as SELECT E.the_geom, E.ID FROM ST_EXPLODE('receivers_building') E, GIP_CALC F WHERE ST_Intersects(E.the_geom, F.the_geom) ;
alter table receivers_facades add column numero serial;
update receivers_facades set numero =default;


The result is very strange because in the column numero I have a number serie but it starts at the value "total number of column +1" and not at 0... I haven't found anything helping me on the web. It is probably some syntax error, but I really don't get it.

Regards,
Rodolphe.


If you reply to this email, your message will be added to the discussion below:
http://orbisgis.3871844.n2.nabble.com/Column-Default-not-found-tp7575289.html
To start a new topic under NoiseM@p, email [hidden email]
To unsubscribe from NoiseM@p, click here.
NAML

 

Reply | Threaded
Open this post in threaded view
|

Re: Column "Default" not found

Rodolphe
Hi,

Thanks, it works perfectly fine with NULL instead of DEFAULT.

Have a nice day,
Rodolphe.