vertica/vertica-sql-go

insert select no effect

king526 opened this issue · 3 comments

when i prepare use select from another table, i found it not work and without an error!

docker=> select * from test1;
  c1   
-------
 hello
 world
(2 rows)

docker=> select * from test2;
 c2 
----
(0 rows)
docker=> INSERT INTO test2(c2) (SELECT c1 FROM test1);
 OUTPUT 
--------
      2
(1 row)

docker=> select * from test2;
  c2   
-------
 hello
 world
(2 rows)
res, err := db.Exec("INSERT INTO test2(c2) (SELECT c1 FROM test1)")
	if err != nil {
		t.Fatal(err)
	}
	t.Log(res.RowsAffected())

--- PASS: TestVerticaDriver (0.05s)
    vertica_test.go:13: 0 <nil>
PASS

the code is simple explain how it happened. my code is more complicated and it report right RowsAffected but nothing happened.

Interesting. I'll have a look at it. Thanks.

@king526,
I've added a branch:
https://github.com/vertica/vertica-sql-go/tree/rhuebner-issue-41-insert-not-working
that contains a test in driver_test.go called TestIssue41_InsertNotWorking .

As near as I can understand, this repros the conditions you mention yet do not see the issue. Can you verify?

Closed as unable to replicate.