Just doing some of the same, but I have a table def like CREATE TABLE ghost_channel (id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), name text Which seems to generate keys for me.
Maybe you could do something like that with your sequence as well? Erik. > On 14. mar. 2016, at 10.53, 'Sven Richter' via Clojure > <[email protected]> wrote: > > 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 [email protected] > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > [email protected] > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
