[Ur] solution to the DB chicken and egg problem?
Marko Schütz Schmuck
markoschuetz at googlemail.com
Mon Apr 3 14:42:19 EDT 2017
On Mon, 03 Apr 2017 09:57:30 -0400,
Adam Chlipala wrote:
>
> I'm not familiar with a standard database feature to allow that mode, but it sounds like you are referencing
> an extra annotation on constraints. Somehow this situation has only come up once in the 10+ years of Ur/
> Web's existence, and it's never been an issue for my own Ur/Web apps.
AFAIK "DEFERRABLE INITIALLY DEFERRED" is standard SQL, but I agree
that it might not be of much practical relevance.
What about the other thought: explicitly merging two dml statements
into one transaction (of course stripping the transactions around the
individual dml statements)?
Best regards,
Marko
> On 04/02/2017 10:10 AM, Marko Schütz Schmuck wrote:
>
> On Sun, 02 Apr 2017 09:02:15 -0400,
> Adam Chlipala wrote:
>
> Actually, Ur/Web won't even accept those table definitions: no mutually recursive
> definitions yet, w.r.t. constraints. And I haven't thought before about allowing
> temporary breaking of constraints.
>
> "Constraints hold after every statement" -> "Constraints hold after
> every transaction"?
>
> On 04/02/2017 08:35 AM, Marko Schütz Schmuck wrote:
>
> If I have tables
>
> table chicken : { Id : int, Egg : int }
> PRIMARY KEY (Id),
> CONSTRAINT egg FOREIGN KEY Egg REFERENCES egg(Id)
>
> table egg : { Id : int, Chicken : int }
> PRIMARY KEY (Id),
> CONSTRAINT chicken FOREIGN KEY Chicken REFERENCES chicken(Id)
>
> Outside of Ur/Web this would be solved by setting the constraints
> DEFERRABLE INITIALLY DEFERRED and do the INSERTs pairwise inside a
> single transaction.
>
> I doubt that there currently is a way to do this in Ur/Web since there
> is neither a way to specify DEFERRABLE INITIALLY DEFERRED nor a way to
> explicitly form transactions.
>
> Would it be enough to introduce an operator
>
> dml_sequence : dml -> dml -> dml
>
> allowing two dml statements to be composed and run in a single
> transaction together with exposing DEFERRABLE INITIALLY DEFERRED at
> the Ur/Web language level?
>
> Best regards,
>
> Marko
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>
>
> [2 <text/plain; utf-8 (base64)>]
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP Digital Signature
URL: <http://www.impredicative.com/pipermail/ur/attachments/20170403/bdf30e78/attachment.sig>
More information about the Ur
mailing list