Blair Z. wrote:
It appears that the documentation was not updated to reflect that this
problem. I do not break the default sequence naming, I do
only work for Serial columns. Try the new patch I just put up which
works for me when I use the DEFAULT nextval(’’) syntax:
The pk_and_sequence_for function in 0.14.3 was broken in 0.14.2 too.
What’s the difference between SERIAL and other using in integer with a
sequence anyway? From what I understand SERIAL is merely a shorthand for
creating an integer column and a sequence that is the default value for
this int column. So affectvily both methods should achive exactlyh the
same. This assumption is backed by the pg docs:
So whichever method you pick, Rails should work as long as the name of
the sequence is recognized.
Please try the patch. If it doesn’t work for you, please amend the
ticket with the exact DDL that doesn’t work.
I’ll try the patch tomorrow when I’m back in the office, but here’s my
DDL just in case:
CREATE TABLE players (
id integer DEFAULT nextval(’“players_id_seq”’::text) NOT NULL,
active boolean DEFAULT false NOT NULL,
perm_level smallint DEFAULT 1 NOT NULL,
email varchar(150) NOT NULL,
fname varchar(60) NOT NULL,
lname varchar(80) NOT NULL,
gender char(1) NOT NULL,
dob date NOT NULL,
passwd varchar(20) NOT NULL,
account_approved boolean DEFAULT false NOT NULL,
image boolean DEFAULT false NOT NULL,
CONSTRAINT chk_unsigned CHECK ((id > 0))
Thanks for your help!