Re: [GENERAL] Question about NOT NULL and default values.

2008-10-17 Thread brian
Scott Marlowe wrote: On Thu, Oct 16, 2008 at 10:06 PM, Stephan Szabo <[EMAIL PROTECTED]> wrote: On Thu, 16 Oct 2008, Scott Marlowe wrote: On Thu, Oct 16, 2008 at 10:01 PM, Stephan Szabo <[EMAIL PROTECTED]> wrote: On Fri, 17 Oct 2008, Tim Uckun wrote: Is there a way to change this behavior s

Re: [GENERAL] Question about NOT NULL and default values.

2008-10-16 Thread Scott Marlowe
On Thu, Oct 16, 2008 at 10:06 PM, Stephan Szabo <[EMAIL PROTECTED]> wrote: > > On Thu, 16 Oct 2008, Scott Marlowe wrote: > >> On Thu, Oct 16, 2008 at 10:01 PM, Stephan Szabo >> <[EMAIL PROTECTED]> wrote: >> > On Fri, 17 Oct 2008, Tim Uckun wrote: >> > >> >> Is there a way to change this behavior so

Re: [GENERAL] Question about NOT NULL and default values.

2008-10-16 Thread Stephan Szabo
On Thu, 16 Oct 2008, Scott Marlowe wrote: > On Thu, Oct 16, 2008 at 10:01 PM, Stephan Szabo > <[EMAIL PROTECTED]> wrote: > > On Fri, 17 Oct 2008, Tim Uckun wrote: > > > >> Is there a way to change this behavior so that an attempt to set the > >> column to NULL will result in the default value bei

Re: [GENERAL] Question about NOT NULL and default values.

2008-10-16 Thread Scott Marlowe
On Thu, Oct 16, 2008 at 10:01 PM, Stephan Szabo <[EMAIL PROTECTED]> wrote: > On Fri, 17 Oct 2008, Tim Uckun wrote: > >> Is there a way to change this behavior so that an attempt to set the >> column to NULL will result in the default value being put in the >> field? > > I don't think so specificall

Re: [GENERAL] Question about NOT NULL and default values.

2008-10-16 Thread Scott Marlowe
On Thu, Oct 16, 2008 at 9:58 PM, Tim Uckun <[EMAIL PROTECTED]> wrote: > On Fri, Oct 17, 2008 at 4:40 PM, Scott Marlowe <[EMAIL PROTECTED]> wrote: >> On Thu, Oct 16, 2008 at 9:09 PM, Tim Uckun <[EMAIL PROTECTED]> wrote: >>> Hey all. >>> >>> I am using postgres 8.3 with a rails application. I have a

Re: [GENERAL] Question about NOT NULL and default values.

2008-10-16 Thread Stephan Szabo
On Fri, 17 Oct 2008, Tim Uckun wrote: > Is there a way to change this behavior so that an attempt to set the > column to NULL will result in the default value being put in the > field? I don't think so specifically with default, but you could use a before trigger instead that would put in a value

Re: [GENERAL] Question about NOT NULL and default values.

2008-10-16 Thread Tim Uckun
On Fri, Oct 17, 2008 at 4:40 PM, Scott Marlowe <[EMAIL PROTECTED]> wrote: > On Thu, Oct 16, 2008 at 9:09 PM, Tim Uckun <[EMAIL PROTECTED]> wrote: >> Hey all. >> >> I am using postgres 8.3 with a rails application. I have a column >> defined like this. >> >> ALTER TABLE provisions ADD COLUMN provide

Re: [GENERAL] Question about NOT NULL and default values.

2008-10-16 Thread Tim Uckun
> > Are you using the ruby-pg interface? I was under the impression it > handled this properly. > I am using postgres-pr -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Question about NOT NULL and default values.

2008-10-16 Thread Scott Marlowe
On Thu, Oct 16, 2008 at 9:09 PM, Tim Uckun <[EMAIL PROTECTED]> wrote: > Hey all. > > I am using postgres 8.3 with a rails application. I have a column > defined like this. > > ALTER TABLE provisions ADD COLUMN provider_id integer; > ALTER TABLE provisions ALTER COLUMN provider_id SET STORAGE PLAIN;

Re: [GENERAL] Question about NOT NULL and default values.

2008-10-16 Thread Scott Marlowe
On Thu, Oct 16, 2008 at 9:26 PM, Tim Uckun <[EMAIL PROTECTED]> wrote: >> Not sure how you do this in rails but if you use DEFAULT in the query it >> works: >> >>> create table a(a int default 5); >> CREATE TABLE >> >>> insert into a(a) values (DEFAULT); >> INSERT 0 1 > > Unfortunately the SQL is be

Re: [GENERAL] Question about NOT NULL and default values.

2008-10-16 Thread Tim Uckun
> Not sure how you do this in rails but if you use DEFAULT in the query it > works: > >> create table a(a int default 5); > CREATE TABLE > >> insert into a(a) values (DEFAULT); > INSERT 0 1 Unfortunately the SQL is being generated by the ORM. I really don't want to bypass the ORM that would be wa

Re: [GENERAL] Question about NOT NULL and default values.

2008-10-16 Thread Scott Marlowe
On Thu, Oct 16, 2008 at 9:09 PM, Tim Uckun <[EMAIL PROTECTED]> wrote: > Hey all. > > I am using postgres 8.3 with a rails application. I have a column > defined like this. > > ALTER TABLE provisions ADD COLUMN provider_id integer; > ALTER TABLE provisions ALTER COLUMN provider_id SET STORAGE PLAIN;

Re: [GENERAL] Question about NOT NULL and default values.

2008-10-16 Thread Chris
Tim Uckun wrote: Hey all. I am using postgres 8.3 with a rails application. I have a column defined like this. ALTER TABLE provisions ADD COLUMN provider_id integer; ALTER TABLE provisions ALTER COLUMN provider_id SET STORAGE PLAIN; ALTER TABLE provisions ALTER COLUMN provider_id SET NOT NULL;