Blair Z. wrote:
-----Original Message-----
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.
http://dev.rubyonrails.org/ticket/2764
http://dev.rubyonrails.com/attachment/ticket/2594/ror-postgresql-pk_and_sequence_for-failure-0.14.3-patch.txt?format=raw
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,
positie integer,
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,
ph_home varchar(13),
ph_mob varchar(13),
ph_work varchar(13),
gender char(1) NOT NULL,
dob date NOT NULL,
passwd varchar(20) NOT NULL,
token char(32),
knltbnr bigint,
activation_code char(32),
account_approved boolean DEFAULT false NOT NULL,
image boolean DEFAULT false NOT NULL,
thumb_x integer,
thumb_y integer,
img_x integer,
img_y integer,
CONSTRAINT chk_unsigned CHECK ((id > 0))
);
Thanks for your help!
Jeroen