SQLite Forum

Colons in column names?
Login
Hi Keith,

Thanks for your thoughtful reply. I've received many here, actually. :)

It looks like I missed a relevant excerpt from the [SQLite SELECT query documentation](https://www.sqlite.org/lang_select.html):

> A subquery specified in the table-or-subquery following the FROM clause in a simple SELECT statement is handled as if it was a table containing the data returned by executing the subquery statement.

A table cannot have multiple columns with the same name. In a sense, we seem to be in the land of undefined behavior. Do you know of a piece of documentation that specifies the "uniquification" strategy SQLite uses? I have not found reference to the ":#" convention. Incidentally, I've seen some unusual column names under the circumstances, like `id:4294631212`.

In fairness to the framework, I am abusing a feature that's meant to be used with select lists from joins. I'm attempting to bend it to subqueries. I just think I can implement my query without subqueries. I'm going to continue looking for a less-than-painful solution.

One final thought. PostgreSQL seems to be okay with duplicate column names from subqueries. Check this out:

[http://sqlfiddle.com/#!17/929a1/5/1](http://sqlfiddle.com/#!17/929a1/5/1)

I did not take the time to delve deeply into their documentation, but I suspect they simple lay out the column names left to right from the underlying relation.