Skip to content

Conversation

@warmwaffles
Copy link
Member

@kevinlang I'm running into some issues with this.

I added the statement that failed to the Exqlite.Error for debugging purposes and add visibility into the actual problem.

"CREATE TABLE posts (id INTEGER PRIMARY KEY, title TEXT, counter INTEGER, blob BLOB, bid TEXT, uuid TEXT, meta JSON, links JSON, intensities JSON, public BOOLEAN, cost DECIMAL(2,1), visits INTEGER, wrapped_visits INTEGER, intensity NUMERIC, author_id INTEGER, posted DATE, inserted_at TEXT_DATETIME NULL, updated_at TEXT_DATETIME NULL)"
"CREATE TABLE posts_users (post_id INTEGER CONSTRAINT posts_users_post_id_fkey REFERENCES posts(id), user_id INTEGER CONSTRAINT posts_users_user_id_fkey REFERENCES users(id))"

"INSERT INTO posts (public,title,uuid,inserted_at,updated_at) VALUES (?,?,?,?,?) RETURNING id"

"INSERT INTO posts (public,title,uuid,inserted_at,updated_at) VALUES (?,?,?,?,?) RETURNING id"

"INSERT INTO posts (public,title,uuid,inserted_at,updated_at) VALUES (?,?,?,?,?) RETURNING id"

%Exqlite.Error{
  message: "no such column: p0.id",
  statement: "UPDATE posts AS p0 SET title = ? RETURNING p0.id, p0.counter, p0.title, p0.blob, p0.public, p0.cost, p0.visits, p0.wrapped_visits, p0.intensity, p0.bid, p0.uuid, p0.meta, p0.links, p0.intensities, p0.posted, p0.author_id, p0.inserted_at, p0.updated_at"
}

With the latest release of sqlite3 amalgamation they fixed a bug https://sqlite.org/src/info/132994c8b1063bfb

I think the bug they fixed was to not allow for a wildcard to be provided, but caused the latter case to fail as well.

@kevinlang
Copy link
Member

Yeah it looks like 3.35.4 disallows use of any table specification in the returning clause. I filed #23 . We will likely need to remove all table specifications for now. It may be supported again in the next minor release.

@warmwaffles
Copy link
Member Author

@kevinlang https://sqlite.org/forum/forumpost/291e6dedac?t=h it may be coming in the future as HIpp doesn't believe it is appropriate for a patch release.

@warmwaffles
Copy link
Member Author

While I was digging through this looking at expr() and what not, the returning clause reuses code, (yay) but we may need to work a whole new angle to it because expressions are allowed within the returning statement, just not references to the table.

@kevinlang
Copy link
Member

kevinlang commented Apr 5, 2021

@warmwaffles I added a naive fix for this and pushed to this PR. I couldn't think of a more elegant way to do it 🤷‍♂️

@kevinlang kevinlang marked this pull request as ready for review April 6, 2021 01:08
@warmwaffles
Copy link
Member Author

This will work for now. Just to unblock us from moving forward.

@warmwaffles warmwaffles merged commit 31a576b into main Apr 6, 2021
@warmwaffles warmwaffles deleted the bump-exqlite branch April 6, 2021 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants