You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem? 1. create two tables, add a field to reference the other table and set notnull=True. e.g.
db.define_table('mytable',
Field('name', 'string'))
db.define_table('mytable2',
Field('name', 'string'),
Field('mytable', db.mytable, notnull=True)) What is the expected output? What do you see instead? the not null constraint is missing in the created db table:
CREATE TABLE mytable2
(
id serial NOT NULL,
"name" character varying(512),
mytable integer,
CONSTRAINT mytable2_pkey PRIMARY KEY (id),
CONSTRAINT mytable2_mytable_fkey FOREIGN KEY (mytable)
REFERENCES mytable (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE
)
WITH (
OIDS=FALSE
);
ALTER TABLE mytable2 OWNER TO postgres;
instead it should be
mytable integer NOT NULL,
for the mytable column. What version of the product are you using? On what operating system? web2py 2.4.4, Windows 7, Postgres 9.0
It appears the DAL ignores notnull, unique, and custom_qualifier for reference fields, though it is not clear why. Should probably be fixed for all three arguments.
From mrauch05@gmail.com on March 18, 2013 12:06:17
What steps will reproduce the problem? 1. create two tables, add a field to reference the other table and set notnull=True. e.g.
db.define_table('mytable',
Field('name', 'string'))
db.define_table('mytable2',
Field('name', 'string'),
Field('mytable', db.mytable, notnull=True)) What is the expected output? What do you see instead? the not null constraint is missing in the created db table:
CREATE TABLE mytable2
(
id serial NOT NULL,
"name" character varying(512),
mytable integer,
CONSTRAINT mytable2_pkey PRIMARY KEY (id),
CONSTRAINT mytable2_mytable_fkey FOREIGN KEY (mytable)
REFERENCES mytable (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE
)
WITH (
OIDS=FALSE
);
ALTER TABLE mytable2 OWNER TO postgres;
instead it should be
mytable integer NOT NULL,
for the mytable column. What version of the product are you using? On what operating system? web2py 2.4.4, Windows 7, Postgres 9.0
Original issue: http://code.google.com/p/web2py/issues/detail?id=1395
The text was updated successfully, but these errors were encountered: