\
> Hi Rails (specifically ActiveRecord) developers: please consider the
> following patch to :
>
> lib/active_record/connection_adapters/postgresql_adapter.rb:

Hi there,

Inserting empty records has been handled, in a different way, in edge
rails, this will work in 2.0.

Thanks,

>
> This patch is against version 1.15.3:
>
> $ diff -u lib/active_record/connection_adapters/
> postgresql_adapter.rb  /tmp
> --- lib/active_record/connection_adapters/postgresql_adapter.rb
> 2007-01-14 18:26:06.000000000 -0800
> +++ /tmp/postgresql_adapter.rb  2007-09-30 10:46:33.000000000 -0700
> @@ -133,6 +133,17 @@
>        # DATABASE STATEMENTS ======================================
>
>        def insert(sql, name = nil, pk = nil, id_value = nil,
> sequence_name = nil) #:nodoc:
> +
> +        # http://www.postgresql.org/docs/8.1/interactive/sql-insert.html
> +        # using regexp to convert : INSERT INTO xxx () VALUES()
> +        # into :                  : INSERT INTO xxx DEFAULT VALUES
> +        # m[1] is the table name.
> +
> +        m = /INSERT\s*INTO\s*(\S+)\s*\(\)\s*VALUES\s*\(\)/.match(sql)
> +        if m
> +          sql = "INSERT INTO #{m[1]} DEFAULT VALUES"
> +        end
> +
>          execute(sql, name)
>          table = sql.split(" ", 4)[2]
>          id_value || last_insert_id(table, sequence_name ||
> default_sequence_name(table, pk))
> eugene-j-koontzs-computer:/tmp/activerecord-1.15.3 ekoontz$ diff -u
> lib/active_record/connection_adapters/postgresql_adapter.rb  /tmp
>
>
> >
>


-- 
Cheers

Koz

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to