[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[SERIOUS BUG?] ActiveRecord 1.1.0 and PostgreSQL

JD

12/11/2004 2:26:00 AM

To reproduce:

1. Create a postgresql table with a varchar primary key.
2. Specify a new key value and try to save the new record.

ActiveRecord will insert the record, and then immediately bomb with an
error when it tries to query a non-existent sequence table. This error
causes the inserted record to get rolled back.

Looks like ActiveRecord assumes that all primary keys have a sequence
table in postgresql.

Am I forgetting to do something or is this a major bug in ActiveRecord?
4 Answers

JD

12/11/2004 2:28:00 AM

0

J. D. wrote:
> To reproduce:
>
> 1. Create a postgresql table with a varchar primary key.
> 2. Specify a new key value and try to save the new record.
>
> ActiveRecord will insert the record, and then immediately bomb with an
> error when it tries to query a non-existent sequence table. This error
> causes the inserted record to get rolled back.
>
> Looks like ActiveRecord assumes that all primary keys have a sequence
> table in postgresql.
>
> Am I forgetting to do something or is this a major bug in ActiveRecord?

Someone reading this message over my shoulder just asked me,
'who is "reproduce"?'

LOL

Sam Stephenson

12/11/2004 5:35:00 AM

0

Hi J. D.,

On Sat, 11 Dec 2004 11:27:24 +0900, J. D. <jd@nospam.com> wrote:
> Looks like ActiveRecord assumes that all primary keys have a sequence
> table in postgresql.
>
> Am I forgetting to do something or is this a major bug in ActiveRecord?
>

It's not a bug, it's a constraint that Active Record puts on your
schema so that it can guess the proper sequence name. For rationale,
see http://www.rubyonrails.org/show/DatabaseCom....

Sam


JD

12/11/2004 1:17:00 PM

0

Sam Stephenson wrote:
> Hi J. D.,
>
> On Sat, 11 Dec 2004 11:27:24 +0900, J. D. <jd@nospam.com> wrote:
>
>>Looks like ActiveRecord assumes that all primary keys have a sequence
>>table in postgresql.
>>
>>Am I forgetting to do something or is this a major bug in ActiveRecord?
>>
>
>
> It's not a bug, it's a constraint that Active Record puts on your
> schema so that it can guess the proper sequence name. For rationale,
> see http://www.rubyonrails.org/show/DatabaseCom....
>
> Sam
>
>

I finally tracked down a bug report and a patch already in CVS. I tried
the patch shown in ticket 230 and it fixed the problem.

http://dev.rubyonrails.org/trac.cgi/...
http://dev.rubyonrails.org/trac.cgi/...

Now I have to fix the loss of my credibility for recommending
ActiveRecord 1.1.0 as being production-ready. Ah well, it's a good
reminder to run our *own* tests even if the product comes with
self-tests (like ruby 1.8.2 snapshots).

I'm glad ActiveRecord didn't put a contraint on the schema forcing us to
use *only* numeric, auto-incrementing primary keys. Many of us have
existing schemas with at least one text primary key--and don't have the
luxury of modifying them.

Will in New Haven

4/9/2011 11:44:00 PM

0

On Apr 9, 2:30 pm, paul <paulh...@infi.net> wrote:
> On Apr 9, 1:21 pm, Will in New Haven <bill.re...@taylorandfrancis.com>
> wrote:
>
>
>
> > On Apr 9, 1:47 pm, paul <paulh...@infi.net> wrote:
>
> > > With one partner, I play that all suit overcalls of notrump are
> > > natural, while a double shows any two or three suited hand (scrambling
> > > double). Partner generally bids a three card minor or six card major.
> > > The only awkward shapes would be 4522, 5422, or 3622 (these would be a
> > > problem over a DONT 2C bid also) where partner has to decide between
> > > 2C on a doubleton or pretending his major is six cards long. Doubler
> > > of course passes or raises if partner bids one of his suits, otherwise
> > > removes to his cheapest suit. Either player can bid 2NT as a general
> > > force.
>
> > > There seem to be several advantages: only one artificial bid to
> > > remember, and while the "takeout" double must be alerted, it's unusual
> > > only to the extent that partner must bid minors first rather than
> > > expect support for his four-card major. Second, if overcaller's suit
> > > outranks responder's (opener's partner), responder must bid at the
> > > three level or pass. Conversely, if responder's suit outranks
> > > overcaller's, fourth hand will know overcaller's suit to lead. The
> > > lead directing advantage is even greater in the balancing seat. Many
> > > players cancel DONT in the balancing seat, leaving no method of
> > > launching two-suiters and frequent confusion in casual partnerships;
> > > this method applies to both positions.
>
> > > Offhand I can't think of any advantage to the one-suited double, two-
> > > suited overcall method (DONT or Brozel.) The advantage of showing one
> > > or even two suits immediately on certain two-suited hands appears to
> > > be smaller than the advantage of showing every one-suited hand
> > > immediately.
>
> > > Thoughts?
>
> > The one-suited double has an advantage when it can be left in. It is
> > harder to defend when the opening leader has two mediocre suits than
> > when he has one good one. On the other hand, that's a fairly minor
> > advantage. Showing two suits immediately would be an advantage if
> > partner had length in a suit he knows you have and wants to compete.
> > For instance, give partner XX XXX XXX XXXXX (shape only; put honors
> > here and there) and you double, his RHO bids 2S to play. He will want
> > to compete if he knows you have Clubs.
>
> > --
> > Will in New Haven
>
> Of course, but responder can compete far more often knowing you have a
> six card (or good five card) suit than four plus an unknown suit. And
> you're right about the double being left in, I recall that with
> Brozel, but as you say it doesn't happen often and when the two/three-
> suited is left in, partner will sometimes be able to switch
> effectively. A one-suited hand with, say, 8 hcp will often lack the
> entries to cash the established suit.

LoL I remember when the late Grace, a good friend but a crazy bidding,
doubled a 15-17 NT with something like Jack sixth and out. I left it
in and I had AKX of the suit, so it ran and we beat the contract a few
tricks. But she had a conniption fit when I left the double in.

Obviously, I didn't realize that such doubles were virtually never to
be left in and we got very lucky. Most of us need something better to
double, although that is a matter for agreement.

--
Will in New Haven