Hi,

I am using joplin (which depends on ragtime) migrate and seed my postgresql 
database. One of my migration files looks like this:

CREATE TABLE tags (
id SERIAL PRIMARY KEY,
name VARCHAR(150))
--;;
INSERT INTO tags ("name", "id") VALUES
('Java', '1')

Running a migration creates the table and inserts the entry. But what it 
does not do is to set the next value of the primary key column. Trying to 
add a new row will result in a "duplicate primary key error". I am not sure 
what ragtime is doing here exactly, Also this did not happen with H2 or 
SQLITE IIRC from other projects.
One solution is to set the counter manually by running:

SELECT setval('tags_id_seq', 1);

It works from the postgres console, but running this as part of the 
migration does not work, I get an exception: PGSQLException: Statement 
returned a result, but none was expected. 

Anyone experienced something similar? Any ideas how to solve it? 

Thanks,
Sven

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to