Bug report: Wrong column name in a table in a certain case

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

Bug report: Wrong column name in a table in a certain case

Jürgen Palm
Hi,

please have a look at the following sequence of statements executed on
Windows 10 with sqlite3.exe, version 3.19.3 and 3.20.0:

CREATE TABLE test("column with space" TEXT);
CREATE TABLE test2 AS SELECT "column with space" FROM test;
CREATE TABLE test3 AS SELECT "column with space" FROM test GROUP BY 1;
CREATE TABLE test4 AS SELECT "column with space" AS "column with space"
FROM test GROUP BY 1;
SELECT * FROM sqlite_master;
table|test|test|2|CREATE TABLE test("column with space" TEXT)
table|test2|test2|3|CREATE TABLE test2("column with space" TEXT)
table|test3|test3|4|CREATE TABLE test3("""column with space""" TEXT)
table|test4|test4|5|CREATE TABLE test4("column with space" TEXT)

As you can see the table "test3" has extra double quotes around the
column name "column with space". There should be no extra double quotes
for this table and table "test3" should look like the tables "test2" and
"test4".

Regards,
Jürgen
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Bug report: Wrong column name in a table in a certain case

Bernd Lehmkuhl-3
Most probably not a bug. I asked something similar a while ago. It's as
easy as https://sqlite.org/faq.html#q28 .
As long as you don't explicitly assign an alias to a column name, sqlite
is not guaranteed to return what you might expect.


Am 11.08.2017 um 22:52 schrieb Jürgen Palm:

> Hi,
>
> please have a look at the following sequence of statements executed on
> Windows 10 with sqlite3.exe, version 3.19.3 and 3.20.0:
>
> CREATE TABLE test("column with space" TEXT);
> CREATE TABLE test2 AS SELECT "column with space" FROM test;
> CREATE TABLE test3 AS SELECT "column with space" FROM test GROUP BY 1;
> CREATE TABLE test4 AS SELECT "column with space" AS "column with space"
> FROM test GROUP BY 1;
> SELECT * FROM sqlite_master;
> table|test|test|2|CREATE TABLE test("column with space" TEXT)
> table|test2|test2|3|CREATE TABLE test2("column with space" TEXT)
> table|test3|test3|4|CREATE TABLE test3("""column with space""" TEXT)
> table|test4|test4|5|CREATE TABLE test4("column with space" TEXT)
>
> As you can see the table "test3" has extra double quotes around the
> column name "column with space". There should be no extra double quotes
> for this table and table "test3" should look like the tables "test2" and
> "test4".
>
> Regards,
> Jürgen
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Bug report: Wrong column name in a table in a certain case

Richard Hipp-3
In reply to this post by Jürgen Palm
Now fixed on trunk.

On 8/11/17, Jürgen Palm <[hidden email]> wrote:

> Hi,
>
> please have a look at the following sequence of statements executed on
> Windows 10 with sqlite3.exe, version 3.19.3 and 3.20.0:
>
> CREATE TABLE test("column with space" TEXT);
> CREATE TABLE test2 AS SELECT "column with space" FROM test;
> CREATE TABLE test3 AS SELECT "column with space" FROM test GROUP BY 1;
> CREATE TABLE test4 AS SELECT "column with space" AS "column with space"
> FROM test GROUP BY 1;
> SELECT * FROM sqlite_master;
> table|test|test|2|CREATE TABLE test("column with space" TEXT)
> table|test2|test2|3|CREATE TABLE test2("column with space" TEXT)
> table|test3|test3|4|CREATE TABLE test3("""column with space""" TEXT)
> table|test4|test4|5|CREATE TABLE test4("column with space" TEXT)
>
> As you can see the table "test3" has extra double quotes around the
> column name "column with space". There should be no extra double quotes
> for this table and table "test3" should look like the tables "test2" and
> "test4".
>
> Regards,
> Jürgen
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users