On Feb 17, 2009, at 4:22 PM, Stu wrote:

>
> On Feb 18, 9:42 am, Stu <[email protected]> wrote:
>
>> [...]
>> /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/ 
>> adapters/
>> data_objects_adapter.rb:92:in `execute_non_query': (sql_state=42601)
>> ERROR:  syntax error at or near "RETURNING" (PostgresError)
>> LINE 1: ...m26/archive/NSW/1833/census/NSW-1833-census.dbk')
>> RETURNING ...
>
>   Hi,
>
>   I'm starting to think this is something to do with resources that
>   have a :serial primary key. My other resources with natural
>   keys seem to load okay.
>
>   Are there any tricks with :serial keys?  A Resource.new should be
>   enough to create a resource with an incremented key?

You're running an older version (< 8.2) of PostgreSQL.  DataMapper  
doesn't support those correctly (I just ran across that exact problem  
this weekend - I'm running 8.1.1).  There is a ticket open for this  
issue, but I don't have it handy.  I'm able to use multiple db servers  
so I got around the problem easily enough ;-)

The newer versions of PostgreSQL support a custom extension that  
returns the serial id generated on the insert.

Cheers,
Rob


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to