-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UNIQUE constraint causes from_rs
to hang
#46
Comments
If I switch back to: crystal-db: 0.3.3 and crystal-pg: 0.13.2 it correctly throws the |
It's probably that the type of the exception is |
I see Should I open the issue on crystal-pg instead? |
I try to narrow it down. It seems an issue in crystal-pg. I reduce a full script that repro the issue. I haven't go any further than this. require "pg"
`psql -c "DROP DATABASE IF EXISTS issue_db_46"`
`createdb issue_db_46`
`psql -d issue_db_46 -c "CREATE TABLE users (name varchar(50), CONSTRAINT key_name UNIQUE(name));"`
`psql -d issue_db_46 -c "INSERT INTO users (name) VALUES ('test');"`
db = DB.open("postgres://localhost/issue-db-46")
puts "A"
db.query "INSERT INTO users (name) VALUES ($1) RETURNING *", "test" do |rs|
rs.move_next
end
puts "Z"
db.close |
Perhaps you could find the offending commit in crystal-pg? |
Also hangs if |
I think this has been fixed |
I wasn't sure whether to make this issue here, or in crystal-pg
Crystal: 0.21.1
Postgres: 9.6.2 (also replicated on 9.4)
crystal-db: 0.4.0
crystal-pg: 0.13.3
If there is a
UNIQUE
constraint on a database field,Model.from_rs(rs)
hangs without returning.If I remove the
UNIQUE
constraint when I create the table, the above code works just fine.The text was updated successfully, but these errors were encountered: