Erlang Mailing Lists

Author Message

<  Erlyweb mailing list  ~  erlydb_psql transactions appear broken

ketralnis
Posted: Tue Dec 04, 2007 3:43 am Reply with quote
User Joined: 20 Jul 2007 Posts: 151 Location: San Francisco, CA
Using psql, I can create save an instance of a model like this:

my_model:save(my_model:new_with([{name,"1"}])).

But if I try to save the same model inside of a transaction, like this:

my_model:transaction(fun() ->
my_model:save(my_model:new_with([{name,"1"}]))
end).

I get the SQL error:

{atomic,{ok,{sql_error,"25P02",
"Rexec_simple_query L928 Fpostgres.c Mcurrent
transaction is aborted, commands ignored until end of transaction
block"}}}

At least the error is atomic!

1. Why doesn't the process die, rather than returning "OK"?
2. Why can't I do this inside of a transaction?
3. Is anybody actually running against psql? Has anybody tested this
driver?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
View user's profile Send private message AIM Address
Guest
Posted: Wed Dec 05, 2007 5:06 am Reply with quote
Guest
Roberto Saccon created this driver, so he should have the most
authoritative opinion on this issue. I haven't tested it but the unit
tests have passed according to other people. Unfortunately, it looks
like the unit tests haven't covered this case. You can try fixing it
(you can see how the MySQL driver handles transactions) or... switch
to MySQL Smile

Yariv

On Dec 3, 2007 7:42 PM, David King <dking@ketralnis.com> wrote:
>
> Using psql, I can create save an instance of a model like this:
>
> my_model:save(my_model:new_with([{name,"1"}])).
>
> But if I try to save the same model inside of a transaction, like this:
>
> my_model:transaction(fun() ->
> my_model:save(my_model:new_with([{name,"1"}]))
> end).
>
> I get the SQL error:
>
> {atomic,{ok,{sql_error,"25P02",
> "Rexec_simple_query L928 Fpostgres.c Mcurrent
> transaction is aborted, commands ignored until end of transaction
> block"}}}
>
> At least the error is atomic!
>
> 1. Why doesn't the process die, rather than returning "OK"?
> 2. Why can't I do this inside of a transaction?
> 3. Is anybody actually running against psql? Has anybody tested this
> driver?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
ketralnis
Posted: Fri Dec 07, 2007 2:21 am Reply with quote
User Joined: 20 Jul 2007 Posts: 151 Location: San Francisco, CA
> Roberto Saccon created this driver, so he should have the most
> authoritative opinion on this issue. I haven't tested it but the unit
> tests have passed according to other people. Unfortunately, it looks
> like the unit tests haven't covered this case.

The unit tests don't cover *running a transaction*?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
View user's profile Send private message AIM Address
Guest
Posted: Fri Dec 07, 2007 8:51 am Reply with quote
Guest
On Dec 6, 2007 6:18 PM, David King <dking@ketralnis.com> wrote:
>
> > Roberto Saccon created this driver, so he should have the most
> > authoritative opinion on this issue. I haven't tested it but the unit
> > tests have passed according to other people. Unfortunately, it looks
> > like the unit tests haven't covered this case.
>
> The unit tests don't cover *running a transaction*?

Apparently not Smile

I should have been adding more test cases as I've been more features
to ErlyDB since I first wrote the tests a long time ago,

Yariv

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum