Bugs item #2807341, was opened at 2009-06-16 21:39
Message generated for change (Comment added) made by mr-meltdown
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2807341&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SQL/Core
Group: SQL CVS Head
Status: Closed
Resolution: Invalid
Priority: 5
Private: Yes
Submitted By: Stefan de Konink (skinkie)
Assigned to: Niels Nes (nielsnes)
Summary: INSERT INTO doesn't match number of columns

Initial Comment:
sql>select naam, vestigingsplaats, beschikking, intrekking, kvk.kvk from 
kvk,anbi where lower(naam) = lower(bedrijfsnaam) and lower(plaats) = 
lower(vestigingsplaats) limit 10;
+------------------------------------------+------------------+-------------+------------+-------------+
| naam                                     | vestigingsplaats | beschikking | 
intrekking | kvk         |
+==========================================+==================+=============+============+=============+
| WERELDWINKEL HEERENVEEN                  | HEERENVEEN       | 2008-01-01  | 
null       | 10702640000 |
| STICHTING MONUMENTENZORG LEEUWARDERADEEL | STIENS           | 2009-01-01  | 
null       |     1079853 |
| STICHTING FRIES NATUURHISTORISCH MUSEUM  | LEEUWARDEN       | 2008-01-01  | 
null       |     1079917 |
| STICHTING VRIENDEN VAN ZIENN             | OENTSJERK        | 2008-01-01  | 
null       |     1080218 |
| NEDERLANDSE HOOFDPIJN STICHTING          | DOKKUM           | 2008-01-01  | 
null       |     1081350 |
| STICHTING SEBO DETMERS                   | OOSTERWOLDE FR   | 2008-01-01  | 
null       |     1081838 |
| STICHTING AMBULANCE DIER IN NOOD         | PEINS            | 2008-01-01  | 
null       |     1082006 |
| STICHTING ORANJECOMITE JOURE             | JOURE            | 2008-01-01  | 
null       |     1082094 |
| STICHTING O.S.G. PITER JELLES            | LEEUWARDEN       | 2008-01-01  | 
null       |     1082181 |
| STICHTING VOORZIENINGEN OLMENES          | APPELSCHA        | 2008-01-01  | 
null       |     1082205 |
+------------------------------------------+------------------+-------------+------------+-------------+
10 tuples
sql>insert into anbikvk values (select naam, vestigingsplaats, beschikking, 
intrekking, kvk.kvk from kvk,anbi where lower(naam) = lower(bedrijfsnaam) and 
lower(plaats) = lower(vestigingsplaats));
!INSERT INTO: number of values doesn't match number of columns of table 
'anbikvk'
0 tuples
sql>\d anbikvk 
CREATE TABLE "sys"."anbikvk" (
        "naam" varchar(256),
        "vestigingsplaats" varchar(32),
        "beschikking" date,
        "intrekking" date,
        "kvk" bigint
);
sql>insert into anbikvk (naam, vestigingsplaats, beschikking, intrekking, kvk) 
values (select naam, vestigingsplaats, beschikking, intrekking, kvk.kvk from 
kvk,anbi where lower(naam) = lower(bedrijfsnaam) and lower(plaats) = 
lower(vestigingsplaats));
!INSERT INTO: number of values doesn't match number of columns of table 
'anbikvk'
0 tuples

Today it was mentioned to 'read' error messages, but counting is also an 
ability that I seem to lack :\

----------------------------------------------------------------------

>Comment By: Fabian (mr-meltdown)
Date: 2009-06-17 10:37

Message:
> !syntax error, unexpected sqlNAME, expecting SCOLON in: "insert into test
name"

name is a reserved keyword, and indeed it is unexpected here (at least I
don't know what it means there, which may be a problem on my side)

----------------------------------------------------------------------

Comment By: Stefan de Konink (skinkie)
Date: 2009-06-17 08:59

Message:
sql>create table test (a integer, b integer);
0 tuples
sql>insert into test name (a) values (select 2);
!syntax error, unexpected sqlNAME, expecting SCOLON in: "insert into test
name"
0 tuples
sql>insert into test (a) values (select 2);
Rows affected 1
sql>insert into test (a,b) values (select 2, 2);
!INSERT INTO: number of values doesn't match number of columns of table
'test'
0 tuples

Can you live with this too?

----------------------------------------------------------------------

Comment By: Fabian (mr-meltdown)
Date: 2009-06-17 08:44

Message:
I can live with that

----------------------------------------------------------------------

Comment By: Stefan de Konink (skinkie)
Date: 2009-06-16 22:23

Message:
I guess my SQL is bad...

insert into anbikvk select naam, vestigingsplaats, beschikking,
intrekking, kvk.kvk from kvk,anbi where lower(naam) = lower(bedrijfsnaam)
and lower(plaats) = lower(vestigingsplaats);

works...

----------------------------------------------------------------------

Comment By: Stefan de Konink (skinkie)
Date: 2009-06-16 22:21

Message:
>create table anbikvk (naam varchar(256), vestigingsplaats varchar(32),
besch
ikking date, intrekking date, kvk bigint);
0 tuples
sql>insert into anbikvk (naam, vestigingsplaats) values (select 'test',
'bla');
!INSERT INTO: number of values doesn't match number of columns of table
'anbikvk
'
0 tuples
sql>drop table anbikvk;
0 tuples
sql>create table anbikvk (naam varchar(256), vestigingsplaats
varchar(32));
0 tuples
sql>insert into anbikvk (naam, vestigingsplaats) values (select 'test',
'bla');
!INSERT INTO: number of values doesn't match number of columns of table
'anbikvk
'
0 tuples
sql>insert into anbikvk (naam, vestigingsplaats) values ('test', 'bla');
Rows affected 1
sql>select 'test', 'bla'
more>;
+--------------+--------------+
| single_value | single_value |
+==============+==============+
| test         | bla          |
+--------------+--------------+
1 tuple


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2807341&group_id=56967

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to