profile
viewpoint

dropbox/pyannotate 1118

Auto-generate PEP-484 annotations

dropbox/sqlalchemy-stubs 273

Mypy plugin and stubs for SQLAlchemy

gvanrossum/pyxl3 118

A Python 3 extension for writing structured and reusable inline HTML.

msullivan/LazyK 12

Updated LazyK source distribution

JukkaL/mypy-website 10

Source code for the mypy web site

msullivan/godels-t 6

Formalization of a bunch of properties of Godel's System T in agda

jwise/minilib 3

A small C library that one might wish to plop down in bare-metal projects.

msullivan/advent-of-code 3

my advent of code solutions

msullivan/cmd-queue 3

A really dumb script for running a queue of commands

msullivan/he-man 2

Haskell Event Manager, Apropos Networking

fork msullivan/riscv-formal

RISC-V Formal Verification Framework

fork in 4 hours

PR opened edgedb/edgedb

Make query normalization use same variable for same constants

This is needed to make select-or-insert work when using constants, since otherwise this hides the equality of constants from the compiler.

Work on #684.

+85 -54

0 comment

4 changed files

pr created time in 10 hours

create barnchedgedb/edgedb

branch : normalize-merge-constants

created branch time in 10 hours

IssuesEvent

issue commentedgedb/edgedb

SELECT Object IF EXISTS Object ELSE INSERT

Remaining pieces: [ ] Update query normalization so that this works for constants [ ] Support nested inserts

cosmophile

comment created time in 10 hours

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 3f80c258867a3d99a9a2b31bb51d9af95e30be20

Implement basic select-or-insert via coalesce (#1628) Implement a select-or-insert idiom using `(SELECT ...) ?? (INSERT ...)`. We only allow it under restricted circumstances (when the select and insert both use the same value for an exclusive property) and it is compiled using ON CONFLICT. This doesn't work when the values are constants yet, because the normalizer treats each constant separately. I'll change that in a follow-up. Mostly fixes #684, modulo follow-up.

view details

push time in 10 hours

delete branch edgedb/edgedb

delete branch : select-or-insert

delete time in 10 hours

PR merged edgedb/edgedb

Implement basic select-or-insert via coalesce

Implement a select-or-insert idiom using (SELECT ...) ?? (INSERT ...).

We only allow it under restricted circumstances (when the select and insert both use the same value for an exclusive property) and it is compiled using ON CONFLICT.

This doesn't work when the values are constants yet, because the normalizer treats each constant separately. I'll change that in a follow-up.

Mostly fixes #684, modulo follow-up.

+325 -21

0 comment

8 changed files

msullivan

pr closed time in 10 hours

issue closededgedb/edgedb

SELECT Object IF EXISTS Object ELSE INSERT

Hi, I tried to use the IF...ELSE and EXISTS clauses in order to construct a query that either selects an item if it exists or else inserts it. So since I can do the following:

SELECT 1 IF EXISTS (SELECT Person FILTER .name = 'Ryan Gosling') 
....... ELSE (SELECT 0);

...I tried to do

SELECT Person FILTER .name = 'Ryan Gosling' 
....... IF EXISTS (SELECT Person FILTER .name = 'Ryan Gosling') 
....... ELSE (SELECT <int64>{});

However I get the error: QueryError: operator 'std::IF' cannot be applied to operands of type 'std::bool', 'std::bool', 'std::int64'

Am I making some syntax error or is this kind of selection not allowed? I assumed it would work because the documentation on IF states anytype as the left assignment, but I have not been able to figure out how to make it work with my schema types.

Thank you very much for your help.

closed time in 10 hours

cosmophile

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 1a6301829e78882f5a8199671e0c66d233b676f2

disallow nested INSERTs since they are miscompiled

view details

Michael J. Sullivan

commit sha ad74bd99df646aae4f7233c478f0596ba878ab46

tweaks

view details

push time in 12 hours

push eventedgedb/edgedb

Michael J. Sullivan

commit sha b3f1384152308e662ec67e6147d1bd688614c38c

test cleanup and fixes

view details

push time in 13 hours

push eventedgedb/edgedb

Michael J. Sullivan

commit sha e19637263ce00c01b35bd1957162c3b08666bb3a

Minor tweaks

view details

Michael J. Sullivan

commit sha 3fc44bba5031a6ed65cba449916cde739b21cb29

fix a test

view details

Michael J. Sullivan

commit sha 6fd5cb14c88da1b01d5902882a64906e3e491c73

no name stuff

view details

Michael J. Sullivan

commit sha 2872055219da546767b04cdaa6de4c61de16556b

rework how constraints are handled

view details

Michael J. Sullivan

commit sha a9cc1394ac9c90dc87843202c81e66744c4797ad

refactor it more

view details

push time in a day

Pull request review commentedgedb/edgedb

Implement basic select-or-insert via coalesce

 class MutatingStmt(Stmt):   class InsertStmt(MutatingStmt):-    pass+    on_conflict: typing.Optional[typing.List[PointerRef]] = None

That turns out to not get the right constraint name, but I think I figured it out.

msullivan

comment created time in a day

Pull request review commentedgedb/edgedb

Implement basic select-or-insert via coalesce

 def compile_GroupQuery(     return result  -@dispatch.compile.register(qlast.InsertQuery)-def compile_InsertQuery(-        expr: qlast.InsertQuery, *, ctx: context.ContextLevel) -> irast.Set:+def simple_stmt_eq(lhs: irast.Base, rhs: irast.Base) -> bool:+    if (+        isinstance(lhs, irast.BaseConstant)+        and isinstance(rhs, irast.BaseConstant)+        and lhs.typeref == rhs.typeref  # XXX?

Oh, yeah. I looked at doing that for the whole comparison and didn't because it wouldn't work for parameters but it should work here.

Does the typeref == comparison actually work, by the way?

msullivan

comment created time in a day

PR opened edgedb/edgedb

Implement basic select-or-insert via coalesce

Implement a select-or-insert idiom using (SELECT ...) ?? (INSERT ...).

We only allow it under restricted circumstances (when the select and insert both use the same value for an exclusive property) and it is compiled using ON CONFLICT.

This doesn't work when the values are constants yet, because the normalizer treats each constant separately. I'll change that in a follow-up.

Mostly fixes #684, modulo follow-up.

+311 -19

0 comment

6 changed files

pr created time in a day

create barnchedgedb/edgedb

branch : select-or-insert

created branch time in a day

issue commentpython/mypy

Segmentation fault with custom TypeTraverserVisitor

There are two issues here: that we don't support what this code does, and that it segfaults. I've opened mypyc/mypyc#754 for the former and submitted #9248 for the latter.

The specific problem is that we don't support subclassing compiled traits from interpreted code. We could create a concrete subclass of TypeTraverserVisitor in complied code, though, and you could subclass that? (Eventually we want to actually support this, of course, but we don't yet.)

mkurnikov

comment created time in 2 days

PR opened python/mypy

Make TypeQuery and TypeTranslator not traits

This makes them usable by non-compiled plugins. This fixes the user-blocking issue in #9001.

+0 -2

0 comment

1 changed file

pr created time in 2 days

create barnchpython/mypy

branch : type-query-notrait

created branch time in 2 days

issue commentpython/mypy

Segfault when working with TypeQuery

There are two issues here: that we don't support what this code does, and that it segfaults. I've opened https://github.com/mypyc/mypyc/issues/754 for the former and submitted https://github.com/python/mypy/pull/9248 for the latter.

I guess three issues: that you can't use TypeQuery usefully. There's any easy fix to that, though, which is that TypeQuery doesn't need to be a trait at all. I'll fix that too.

sobolevn

comment created time in 2 days

PR opened python/mypy

Reviewers
Dynamically disallow instantiating traits/interpreted subclasses

This prevents a bunch of segfaults

Closes #9001. Closes #8360. It doesn't close either of them in a satisfactory way, though. Really they would like actual support, which I've opened as mypyc/mypyc#754.

Related to mypyc/mypyc#655. (At some point there used to be working dynamic checks for at least one of these cases. Not sure when that broke.)

+54 -1

0 comment

2 changed files

pr created time in 2 days

create barnchpython/mypy

branch : trait-errors

created branch time in 2 days

issue openedmypyc/mypyc

Support interpreted subclasses of traits (and direct trait instantiation?)

We should support interpreted subclasses of traits. I think that most approaches to accomplishing that should also make it possible to directly create instances of traits.

created time in 2 days

issue closedmypyc/mypyc

Subclassing across native/python boundary

A major obstacle to the plan of a module-at-a-time bootstrapping of mypy is that current our generated extension classes can neither subclass nor be subclassed by interpreted classes.

This means that a superclass needs to be moved to being compiled with mypyc at the same time as all of its subclasses. Currently, NodeVisitor is inherited from in 7 modules and TypeVisitor in 14.

There are two directions this can be addressed in:

  1. Allow mypyc classes to inherit from interpreted classes. I think this won't be very hard, and I've managed to get an extension class to extend a interpreted class in manual testing. The downside is that the visitor interfaces can't switch to using efficient vtable calls until every implementation of the interface is working under mypyc.
  2. Allow certain mypyc classes to be extended by interpreted classes. I think the thing that makes the most sense is to allow traits to be extended. The tricky part is that generated code will make method calls to the trait via the vtable and we need to be able to redirect these calls to overridden interpreted methods. We can do this by generating wrappers for all of the trait methods that invoke the method via the C-API. If the method hasn't been overridden by an interpreted subclass, then it will end up back at the normal native implementation, and if it has it will end up calling the interpreted function.

The main question then I think is: "is it worth it to do #2 or should we just do #1 and figure we can migrate anything before it matters".

closed time in 2 days

msullivan

issue commentmypyc/mypyc

Subclassing across native/python boundary

This was closed by https://github.com/python/mypy/pull/8004 but I messed up the close

msullivan

comment created time in 2 days

issue commentpython/mypy

Segfault when working with TypeQuery

OK, the issue here is https://github.com/mypyc/mypyc/issues/655, I think

sobolevn

comment created time in 2 days

issue commentpython/mypy

Segfault when working with TypeQuery

OK there are a handful of issues with traits at play, all involving things that I didn't expect to work but did think that we produced error messages at runtime for?

  1. Instantiating traits directly doesn't work.
  2. Subclassing traits from interpreted code doesn't work.

We definitely definitely need to be able to produce error messages here. We probably want to be able to support it also.

sobolevn

comment created time in 3 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha ff869ab54d63968081d54e99b4dfb8f2b62f9ce8

Make the debug dump print sequence-specific brackets (#1611) So tuples get '() and sets get '{}'.

view details

push time in 5 days

delete branch edgedb/edgedb

delete branch : brackets

delete time in 5 days

PR merged edgedb/edgedb

Make the debug dump print sequence-specific brackets

So tuples get '() and sets get '{}'.

I was initially confused by my tuples having brackets, and so made this tweak. Mostly I just like the output more.

shrug

+15 -4

0 comment

4 changed files

msullivan

pr closed time in 5 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 6a56bc49d9f2e95d08ce60e5a721c183266d35ab

fix test

view details

push time in 5 days

create barnchedgedb/edgedb

branch : brackets

created branch time in 6 days

PR opened edgedb/edgedb

Make the debug dump print sequence-specific brackets

So tuples get '() and sets get '{}'.

I was initially confused by my tuples having brackets, and so made this tweak. Mostly I just like the output more.

shrug

+14 -3

0 comment

3 changed files

pr created time in 6 days

issue openedwilliamg/p4

Please take this down

Please don't post solutions to course projects :(

created time in 6 days

fork msullivan/riscv-asm-manual

RISC-V Assembly Programmer's Manual

fork in 6 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 15980391ce5535e938c45f836548efed1307c360

Don't crash on empty set as FOR iterator. (#1604) This catches the issue and reports an error in the compiler. Fixes #1585.

view details

push time in 7 days

delete branch edgedb/edgedb

delete branch : empty-set-crash-2

delete time in 7 days

PR merged edgedb/edgedb

Don't crash on empty set as FOR iterator.

This catches the issue and reports an error in the compiler.

Fixes #1585.

I figure there's no compelling reason to also catch the special syntactic case in the parser, given that we need to handle it in a more general way in the compiler anyway?

+40 -1

0 comment

3 changed files

msullivan

pr closed time in 7 days

issue closededgedb/edgedb

InternalServerError: local variable 'derived' referenced before assignment

<!-- Please search existing issues to avoid creating duplicates. -->

  • EdgeDB Version: Docker: 1.0a4-2020071615~buster

This code causes error:

START TRANSACTION;
START MIGRATION TO {
    module default {
        function create_user() -> str
        {
            using EdgeQL $$
                FOR x IN {}
                UNION ()
            $$;
        };
    };
};

This seems related to FOR x IN {}. Adding code to UNION block does not change anything, replacing {} with value removes error.

closed time in 7 days

Fogapod

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 5eccfeb5aee99913ca6fb8d0367007881c4d4807

Initial take at reworking "Queries" documentation (#1551) The existing version doesn't cover cases like when `User.firstname`, `User.friends.firstname`, and `User.friends.lastname` are all mentioned and the `User.friends` sets need to be dependent on the elements in `User`.

view details

push time in 7 days

delete branch edgedb/edgedb

delete branch : query-semantics

delete time in 7 days

PR merged edgedb/edgedb

Initial take at reworking "Queries" documentation

This is solidly a draft and I'm not totally happy with my formulation or my wording, but I want to make sure that it is /correct/ before I work on reformulating it much.

The existing version doesn't cover cases like when User.firstname, User.friends.firstname, and User.friends.lastname are all mentioned and the User.friends sets need to be dependent on the elements in User.

+37 -17

3 comments

1 changed file

msullivan

pr closed time in 7 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 264f46daa47f4a6b43ca71fe1cc8795b4ba8e031

tweak

view details

push time in 7 days

delete branch edgedb/edgedb

delete branch : dmypy

delete time in 7 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha cd5c9ab1d280d69f4e53dae73b8f397e84bfb094

Update mypy and add .dmypy.json to .gitignore (#1603) The mypy version update includes support for --follow-imports=normal in dmypy, which makes it a lot nicer to use.

view details

push time in 7 days

PR merged edgedb/edgedb

Update mypy and add .dmypy.json to .gitignore

The mypy version update includes support for --follow-imports=normal in dmypy, which makes it a lot nicer to use.

+2 -1

0 comment

2 changed files

msullivan

pr closed time in 7 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 679cc3ed70e0eae76669e9dd24ff834cee74b1bc

tweaks

view details

push time in 7 days

Pull request review commentedgedb/edgedb

Don't crash on empty set as FOR iterator.

 def compile_ForQuery(             iterator_stmt = setgen.new_set_from_set(                 iterator_view, preserve_scope_ns=True, ctx=scopectx) +            ptr_target = inference.infer_type(iterator_stmt, ctx.env)+            anytype = ptr_target.find_any(ctx.env.schema)+            if anytype is not None:

Though we could just use the type itself without any trouble in the cases that seem likely here

msullivan

comment created time in 7 days

Pull request review commentedgedb/edgedb

Don't crash on empty set as FOR iterator.

 def derive_view(                     stmtctx.pend_pointer_cardinality_inference(                         ptrcls=ptr, ctx=ctx) +    else:+        raise RuntimeError("unsupported type in derive_view")

AssertionError seems best to me if we want to standarize, since a lot of such errors are going to be assertion rerors

msullivan

comment created time in 7 days

PR opened edgedb/edgedb

Don't crash on empty set as FOR iterator.

This catches the issue and reports an error in the compiler.

Fixes #1585.

I figure there's no compelling reason to also catch the special syntactic case in the parser, given that we need to handle it in a more general way in the compiler anyway?

+40 -1

0 comment

3 changed files

pr created time in 7 days

create barnchedgedb/edgedb

branch : empty-set-crash-2

created branch time in 7 days

PR closed edgedb/edgedb

Reviewers
Disallow empty set literals in FOR ... UNION statements

They don't do anything useful and some internals can't handle them. Fixes #1585.

+22 -1

0 comment

2 changed files

msullivan

pr closed time in 8 days

Pull request review commentedgedb/edgedb

Disallow empty set literals in FOR ... UNION statements

 def test_edgeql_syntax_updatefor_01(self):         UNION (UPDATE Foo FILTER (Foo.id = x.0) SET {bar := x.1});         """ +    @tb.must_fail(errors.EdgeQLSyntaxError,+                  r"Unexpected '}'",+                  line=2, col=27)+    def test_edgeql_syntax_empty_for_01(self):+        """+        SELECT (FOR x in {} UNION ());+        """

@elplans suggested the syntactic approach because your snippet isn't valid syntax: the set in a FOR needs to be a set-literal.

That said, WITH s := {} SELECT (FOR x in {s} UNION ()); triggers the same crash, so I'm going to abandon the syntactic approach.

msullivan

comment created time in 8 days

pull request commentaclements/latexrun

Add a --query flag that lets make query if there is work to be done

(Closing to tidy up my dashboards)

msullivan

comment created time in 8 days

PR closed aclements/latexrun

Add a --query flag that lets make query if there is work to be done

A more correct and simpler (though probably slower) version of what I was going for in #20.

To facilitate make integration without running make rules unless there is actual work to be done, we add a --query flag to latexrun that outputs 'FORCE' when latexrun needs to be run. The Makefile can then shell out to 'latexrun --query' and use the result as a dependency.

+19 -11

2 comments

2 changed files

msullivan

pr closed time in 8 days

PR opened edgedb/edgedb

Update mypy and add .dmypy.json to .gitignore

The mypy version update includes support for --follow-imports=normal in dmypy, which makes it a lot nicer to use.

+2 -1

0 comment

2 changed files

pr created time in 8 days

create barnchedgedb/edgedb

branch : dmypy

created branch time in 8 days

create barnchedgedb/edgedb

branch : empty-set-crash

created branch time in 8 days

PR opened edgedb/edgedb

Disallow empty set literals in FOR ... UNION statements

They don't do anything useful and some internals can't handle them. Fixes #1585.

+22 -1

0 comment

2 changed files

pr created time in 8 days

Pull request review commentpython/mypy

[mypyc] Constant integer registers optimization

 def test_simple(self) -> None:         fn = FuncIR(FuncDecl('myfunc', None, 'mod', FuncSignature([self.arg], int_rprimitive)),                     [self.block], self.env)         emitter = Emitter(EmitterContext(NameGenerator([['mod']])))-        generate_native_function(fn, emitter, 'prog.py', 'prog')+        generate_native_function(fn, emitter, 'prog.py', 'prog', False)

Pass False by keyword; boolean arguments are hard to understand without it

TH3CHARLie

comment created time in 8 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 8b14cc682b26d7c465ccf2f79abe98b713006cb8

Support adding constraints to object types in SDL (#1599) Fixes #1164.

view details

push time in 8 days

delete branch edgedb/edgedb

delete branch : object-cnstr-sdl

delete time in 8 days

PR merged edgedb/edgedb

Support adding constraints to object types in SDL

Fixes #1164.

Depends on https://github.com/edgedb/edgedb/pull/1581.

+75 -2

0 comment

7 changed files

msullivan

pr closed time in 8 days

issue closededgedb/edgedb

Add constraint syntax to object types

Currently we allow declaring constraints only on properties and links (syntactically), but not on object types. This is largely an oversight, since we already have all the necessary mechanisms.

closed time in 8 days

elprans

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 3a14dce1f03a6047d0e03de89c4388f8fc9d5857

add another test

view details

push time in 8 days

push eventedgedb/edgedb

Victor Petrovykh

commit sha dd11f5797e68a12a01ddf9264715254eabba3e0a

Make the error message less cryptic. Currently we can only support scalar values for input variables, which the error message now explicitly states. Issue: #1241

view details

Elvis Pranskevichus

commit sha a9a07386059cbadf137c648065e5b30c2ee111f2

Fix handling of literal empty sets of object types (#1592) Literal empty set of object type (i.e. `<Foo>{}`) is currently erroneously returning an entire set of `Foo` instead of an empty set. Fixes: #1589

view details

Elvis Pranskevichus

commit sha 602cca6ecc691601f6d2b72b9bd59af270080b1c

Make sure delayed inference work is not missed in WITH/FOR aliases The bug was introduced in 3bbfda45d86 by placing the `tentative_work` iteration in a branch that may not always execute. Per report from @Fogapod. Fixes: #1594.

view details

Elvis Pranskevichus

commit sha 4ab945ae27f64dc3b1dc196e3127d2a4043727b1

Make sure singleton IF does not produce erronous NULLs in output When both leaves of an `IF` are singleton, we emit a `CASE WHEN` statement, which converts empty rels back into `NULLs` and so the null check must be reinstated around it. Per report from @Fogapod in #1594.

view details

Michael J. Sullivan

commit sha 41e6bbac3cecdb0fabed9f117b96da1fc6427692

Support adding constraints to object types in DDL (#1581) Work on #1164.

view details

Michael J. Sullivan

commit sha 64c51fce25ed8ac3a022c33f5874e1204353b92d

Support adding constraints to object types in SDL Fixes #1164.

view details

push time in 8 days

delete branch edgedb/edgedb

delete branch : object-cnstr

delete time in 8 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 41e6bbac3cecdb0fabed9f117b96da1fc6427692

Support adding constraints to object types in DDL (#1581) Work on #1164.

view details

push time in 8 days

PR merged edgedb/edgedb

Support adding constraints to object types in DDL

SDL support to come in a follow-up.

Work on #1164.

+145 -0

0 comment

4 changed files

msullivan

pr closed time in 8 days

PR opened edgedb/edgedb

Support adding constraints to object types in SDL

Fixes #1164.

Depends on https://github.com/edgedb/edgedb/pull/1581.

+55 -2

0 comment

7 changed files

pr created time in 8 days

create barnchedgedb/edgedb

branch : object-cnstr-sdl

created branch time in 8 days

issue openededgedb/edgedb

Bad error for nontrivial constraints on links

CREATE TYPE Foo {
    CREATE PROPERTY bar -> str;
};
CREATE TYPE Bar {
    CREATE LINK foo -> Foo {
        CREATE CONSTRAINT std::exclusive on (__subject__.bar);
    }
};

produces edb.errors.InternalServerError: unexpectedly long path in simple expr.

Since we can't support this now (due to requiring multi-table constraints), we should produce a real error message instead.

created time in 9 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha e122f627e4825642af539ebe174cb05c1fbc5875

drop pointless select

view details

push time in 9 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha a855b9188a8b3a231462972a01fbbbc6b2181d46

tweak message

view details

Michael J. Sullivan

commit sha 9e29687b584beccedb6d262a3320f791e07bd54e

don't use SET MODULE

view details

Michael J. Sullivan

commit sha eddf298a15167af8af9b366ebbd5800599c82d0b

Add a basic test for constraints using labels

view details

push time in 9 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 9213a41ce56edff00c1007032eaf92e577ec9909

Test and handle multi properties

view details

push time in 11 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha ef8c8d495158cb4003f56aaccaaa2bdd73f64acb

Update docs/edgeql/ddl/objects.rst Co-authored-by: Elvis Pranskevichus <elvis@edgedb.com>

view details

push time in 12 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 3e9d7be8836f9a10be1d1ec39c9bc0a3469fde8b

Update docs/edgeql/ddl/objects.rst Co-authored-by: Elvis Pranskevichus <elvis@edgedb.com>

view details

push time in 12 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha b4b04e8a5b422c0ba436c9a6c2f80c2be5dfeea4

Update docs/edgeql/ddl/objects.rst Co-authored-by: Elvis Pranskevichus <elvis@edgedb.com>

view details

push time in 12 days

PR opened edgedb/edgedb

Support adding constraints to object types in DDL

SDL support to come in a follow-up.

Work on #1164.

+76 -0

0 comment

3 changed files

pr created time in 12 days

create barnchedgedb/edgedb

branch : object-cnstr

created branch time in 12 days

issue closededgedb/edgedb

Improve support for JSON casts

Currently, casting to and from std::json is supported only for scalar types. This proposes to extend JSON casting support to collection types as well as allowing to cast objects to std::json.

New rules:

  1. <json>Object returns a json value containing the output representation of the object. That is, the result is the same as SELECT Object in JSON mode, including the type shape.

  2. Scalar casts now work only for scalar JSON values, so casting a non-scalar JSON value to std::str is an error, and <json>'{"foo":"bar"}' returns a JSON string ("{\"foo\":\"bar\"}"), not a JSON object.

  3. Non-scalar string-to-JSON and JSON-to-string casting is accomplished by the new str_to_json(str) -> json and json_to_str(json) -> str functions correspondingly.

  4. <json>array_value returns a JSON array

  5. <array<type>>json_value returns an EdgeQL array of the given type. null values in input produce an error (if the target type is not json, use json_array_unpack for fine-grained casting).

  6. <json>tuple_value returns a JSON array and conversely <tuple<...>>json_value converts a JSON array into a tuple. null elements in input produce an error (if the target element type is not json).

  7. <json>named_tuple_value returns a JSON object and conversely <tuple<name: type...>>json_value converts a JSON object/array into a named tuple. null values in input produce an error (if the target type is not json).

closed time in 12 days

elprans

issue commentedgedb/edgedb

Improve support for JSON casts

I think this is done

elprans

comment created time in 12 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 2ec4cbba2aa94d73c75ce10bfca7d767017fe40f

Disallow using std::exclusive on scalar types (#1575) Fixes #1182.

view details

push time in 12 days

delete branch edgedb/edgedb

delete branch : is-aggregate

delete time in 12 days

PR merged edgedb/edgedb

Disallow using std::exclusive on scalar types

Fixes #1182.

+25 -2

0 comment

4 changed files

msullivan

pr closed time in 12 days

issue closededgedb/edgedb

InternalServerError error creating scalar type

<!-- Please search existing issues to avoid creating duplicates. -->

  • EdgeDB Version: 1.0-alpha.2+dev.505.g5b68ec24

Steps to Reproduce:

START TRANSACTION;
CREATE MIGRATION init TO {
    module default {
        scalar type unique_name extending str {
            constraint exclusive;
        }
    }
};
COMMIT MIGRATION init;

Error: InternalServerError: column "78096142-4760-11ea-ad7d-c3dbbf5ced49" does not exist

I found another InternalServerError while playing with this:

START TRANSACTION;
CREATE MIGRATION init TO {
    module default {
        scalar type unique_name extending str {
            constraint exclusive on (str_lower(__subject__));
        }
    }
};
COMMIT MIGRATION init;

Error: InternalServerError: argument of CHECK must be type boolean, not type text

I'm not sure if the latter is a bug, I'm using it wrong, but InternalServerError is scary.

Is it possible to declare exclusive constraint in scalar so that it checks lowercase value? My plan to use it is:

type User {
    required property nickname -> unique_name;
    # ...
    index on (str_lower(__subject__.nickname));
}

unique_name has other constraints, but I removed them to simplify my report.

closed time in 12 days

Fogapod

push eventedgedb/edgedb

Michael J. Sullivan

commit sha 455e967e1b61be9ea972032b82affcc6b3cc1637

Support constraints on tuple types (#1576) Fixes #1288.

view details

push time in 12 days

delete branch edgedb/edgedb

delete branch : tuple-cnstr

delete time in 12 days

PR merged edgedb/edgedb

Support constraints on tuple types

Fixes #1288.

+37 -0

0 comment

3 changed files

msullivan

pr closed time in 12 days

issue closededgedb/edgedb

Constraints on tuple types

Defining a constraint on a tuple property currently results in an error:

a> CREATE TYPE Transaction {
..     CREATE PROPERTY credit -> tuple<amount: decimal, currency: str> {
..         CREATE CONSTRAINT max_value(0) ON (__subject__.amount)
..     };
.. };
InternalServerError: unexpectedly long path in simple expr

closed time in 12 days

elprans

PR opened edgedb/edgedb

Support constraints on tuple types

Fixes #1288.

+37 -0

0 comment

3 changed files

pr created time in 12 days

create barnchedgedb/edgedb

branch : tuple-cnstr

created branch time in 12 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha c6ddd79d7ab085f231895f8767c1cdb2b9b00bf4

tweak message

view details

push time in 12 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha fa791fb54b8c0523342822a0cd7cef2569298f4a

Implement casts from json to tuple types (#1572) The strategy I used was to do it at the IR level by making calls to `json_get`. Finishes #251, I think.

view details

Elvis Pranskevichus

commit sha 2862c89f38fa559e4a462542aea449de7d6bd1aa

Add explicit declarations for casts from json to collections (#1574) This is to explicitly indicate support for the newly added `std::json` casts.

view details

Victor Petrovykh

commit sha 20b0bd7fe932f1e73c0980495d648f9b4dd33bef

Fix multiple mutations. (#1569) It's perfectly valid in GraphQL to perform several mutaiton operations in a single mutation query. Fixes: #1566

view details

Michael J. Sullivan

commit sha 5f9fc14ad4329c0555ed41c0d4e2147f40b1d8b3

Disallow using std::exclusive on scalar types Fixes #1182.

view details

push time in 13 days

create barnchedgedb/edgedb

branch : is-aggregate

created branch time in 13 days

PR opened edgedb/edgedb

Disallow using std::exclusive on scalar types

Fixes #1182.

+23 -2

0 comment

4 changed files

pr created time in 13 days

Pull request review commentedgedb/edgedb

Add explicit declarations for casts from json to collections

 EDGEDB_VISIBLE_METADATA_PREFIX = r'EdgeDB metadata follows, do not modify.\n'  # Increment this whenever the database layout or stdlib changes.-EDGEDB_CATALOG_VERSION = 2020_07_14_14_00+EDGEDB_CATALOG_VERSION = 2020_07_23_00_00

Aha, I've missed doing this!

elprans

comment created time in 13 days

push eventedgedb/edgedb

Michael J. Sullivan

commit sha fa791fb54b8c0523342822a0cd7cef2569298f4a

Implement casts from json to tuple types (#1572) The strategy I used was to do it at the IR level by making calls to `json_get`. Finishes #251, I think.

view details

push time in 13 days

delete branch edgedb/edgedb

delete branch : json-tuple-cast

delete time in 13 days

PR merged edgedb/edgedb

Implement casts from json to tuple types

The strategy I used was to do it at the IR level by making calls to json_get.

Finishes #251, I think.

+183 -4

0 comment

2 changed files

msullivan

pr closed time in 13 days

more