[postgis-users] Insert [off-topic]

Robert Burgholzer rburghol at chesapeakebay.net
Thu Mar 23 09:22:57 PST 2006


When you do a "select" instead of a "values" statement for the values to
insert, you shouldn't have the parentheses around the select column
names. I.E>:

 

Insert into tinytable (tinyid, tinyname) select bigid, bigname from
bigtable;

IS GOOD, WHILE 

Insert into tinytable (tinyid, tinyname) select ( bigid, bigname ) from
bigtable;

IS BAD.

 

HTH,

r.b.

________________________________

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Ezequias Rodrigues da Rocha
Sent: Thursday, March 23, 2006 12:10 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Insert [off-topic]

 

Mark,

I tryed what you recommended but I got another strange error again:

insert into imoveis  (dsqf,
atividade,natureza,cod_lograd,num_imov,subunidade,num_bloco, bloco,
tipo_subun, propriet, area_terre, area_total,area_unida,test_princ,
test_fict,patrimonio, muro,calcada,pedologia,
topografia,formato,tip_estrut,tip_edif,acabamento,est_constr,pavimentac,
geocodigo,inscricao,sequencial,  planta, quadra,
desc_impo,cod_impo,desc_limpe,cod_limpe,desc_ilumi, cod_ilumi,pontos_vu,
log_tipo,
log_titulo,log_prepos,nome_do_lo,razao,fantazia,cgc,desc_ativi,codbairro
,nomebairro, zona,zona_nome, preserva,coleta,dtcadastro,dthabit )
select
(dsqf,atividade,natureza,cod_lograd,num_imov,subunidade,num_bloco,
bloco, tipo_subun, propriet, area_terre,
area_total,area_unida,test_princ, test_fict,patrimonio,
muro,calcada,pedologia,
topografia,formato,tip_estrut,tip_edif,acabamento,est_constr,pavimentac,
geocodigo,inscricao,sequencial,  planta, quadra,
desc_impo,cod_impo,desc_limpe,cod_limpe,desc_ilumi, cod_ilumi,pontos_vu,
log_tipo,
log_titulo,log_prepos,nome_do_lo,razao,fantazia,cgc,desc_ativi,codbairro
,nomebairro, zona,zona_nome, preserva,coleta,dtcadastro,dthabit ) from
imoveis3;

ERROR:  column "dsqf" is of type character varying but expression is of
type record
HINT:  You will need to rewrite or cast the expression.
dbpotgis=#

And now friend ?



Mark Cave-Ayland escreveu: 

	From: postgis-users-bounces at postgis.refractions.net
	    

[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Ezequias
Rodrigues da Rocha
  

	Sent: 23 March 2006 13:01
	To: PostGIS Users Discussion
	Subject: [postgis-users] Insert [off-topic]
	    

 
(cut)
 
  

	I am trying to add a table inside of another using this command
line:
	 
	dbpotgis=# INSERT INTO imoveis select * from imoveis3;
	ERROR:  value too long for type character varying(2)
	 
	But as you can see there is a small message that don't tell
anything about
	    

the problem.
 
 
Hi Ezequias,
 
The message is telling you that you're trying to put a string longer
than 2
characters into a varchar(2) column. The most likely cause is that you
aren't specifying the column list manually and the column order is
different
between the two tables. You should be able to solve this by manually
specifying the order of your columns, for example:
 
        INSERT INTO imoveis (col1, col2... col3) SELECT col1, col2...
col3
FROM imoveis3;
 
 
Kind regards,
 
Mark.
 
------------------------
WebBased Ltd
17 Research Way
Plymouth
PL6 8BT
 
T: +44 (0)1752 797131
F: +44 (0)1752 791023
 
http://www.webbased.co.uk  
http://www.infomapper.com
http://www.swtc.co.uk 
 
This email and any attachments are confidential to the intended
recipient
and may also be privileged. If you are not the intended recipient please
delete it from your system and notify the sender. You should not copy it
or
use it for any purpose nor disclose or distribute its contents to any
other
person.
 
 
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
 
  





-- 
Ezequias Rodrigues da Rocha
http://ezequiasrocha.blogspot.com
msn:ezequias at hotmail.com
"the worst of democracies is still better than the best of dictatorship"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060323/015910cb/attachment.html>


More information about the postgis-users mailing list