dropbox/pyannotate 1127
Auto-generate PEP-484 annotations
Mypy plugin and stubs for SQLAlchemy
gvanrossum/pyxl3 119
A Python 3 extension for writing structured and reusable inline HTML.
Updated LazyK source distribution
Source code for the mypy web site
Formalization of a bunch of properties of Godel's System T in agda
A small C library that one might wish to plop down in bare-metal projects.
my advent of code solutions
A really dumb script for running a queue of commands
Haskell Event Manager, Apropos Networking
push eventedgedb/edgedb
commit sha d187a93396325294037b6d77e2e498765e92965c
Fix crash when applying nested shape to a scalar. (#1795) mypy would have caught this except that lies in the AST about Optional caused it to think most of the function was unreachable. Most of this PR is actually just fixing the fallout from that. I also added parser contexts to this error while I was at it. Fixes #1788.
push time in a day
PR merged edgedb/edgedb
mypy would have caught this except that lies in the AST about Optional caused it to think most of the function was unreachable. Most of this PR is actually just fixing the fallout from that. I also added parser contexts to this error while I was at it.
Fixes #1788.
pr closed time in a day
issue closededgedb/edgedb
The query is obviously wrong but it should fail with a proper error:
SELECT schema::ObjectType {
name,
is_abstract: {
name,
} ORDER BY @index ASC,
} FILTER .name = 'sys::Role';
Currently fails with
ERROR: InternalServerError:
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/Users/yury/dev/edge/edgedb/edb/server/procpool/worker.py", line 75, in worker
res = await meth(*args)
File "/Users/yury/dev/edge/edgedb/edb/server/compiler/compiler.py", line 1795, in compile_eql_tokens
return self._compile(ctx=ctx, tokens=eql_tokens)
File "/Users/yury/dev/edge/edgedb/edb/server/compiler/compiler.py", line 1429, in _compile
comp: dbstate.BaseQuery = self._compile_dispatch_ql(ctx, stmt)
File "/Users/yury/dev/edge/edgedb/edb/server/compiler/compiler.py", line 1392, in _compile_dispatch_ql
return self._compile_ql_query(ctx, ql)
File "/Users/yury/dev/edge/edgedb/edb/server/compiler/compiler.py", line 592, in _compile_ql_query
ir = qlcompiler.compile_ast_to_ir(
File "/Users/yury/dev/edge/edgedb/edb/edgeql/compiler/__init__.py", line 175, in wrapper
return func(*args, **kwargs)
File "/Users/yury/dev/edge/edgedb/edb/edgeql/compiler/__init__.py", line 223, in compile_ast_to_ir
ir_set = dispatch_mod.compile(tree, ctx=ctx)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/functools.py", line 874, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/Users/yury/dev/edge/edgedb/edb/edgeql/compiler/stmt.py", line 84, in compile_SelectQuery
stmt.result = compile_result_clause(
File "/Users/yury/dev/edge/edgedb/edb/edgeql/compiler/stmt.py", line 1017, in compile_result_clause
ir_result = compile_query_subject(
File "/Users/yury/dev/edge/edgedb/edb/edgeql/compiler/stmt.py", line 1097, in compile_query_subject
view_scls = viewgen.process_view(
File "/Users/yury/dev/edge/edgedb/edb/edgeql/compiler/viewgen.py", line 86, in process_view
view_scls = _process_view(
File "/Users/yury/dev/edge/edgedb/edb/edgeql/compiler/viewgen.py", line 173, in _process_view
pointer = _normalize_view_ptr_expr(
File "/Users/yury/dev/edge/edgedb/edb/edgeql/compiler/viewgen.py", line 549, in _normalize_view_ptr_expr
ptr_target = _process_view(
File "/Users/yury/dev/edge/edgedb/edb/edgeql/compiler/viewgen.py", line 160, in _process_view
assert isinstance(view_scls, s_objtypes.ObjectType)
AssertionError
closed time in a day
1st1push eventedgedb/edgedb
push time in 2 days
push eventedgedb/edgedb
commit sha 8f05dd19fbde63857c322152d5941b9ad27904b3
WIP types
push time in 2 days
issue commentedgedb/edgedb
Mark optional types in the AST as Optional
I started fixing some of this and it might be less bad than I feared but I also discovered that schema.get basically always is inferred as returning None which seems pretty bad
comment created time in 2 days
PR opened edgedb/edgedb
mypy would have caught this except that lies in the AST about Optional caused it to think most of the function was unreachable. Most of this PR is actually just fixing the fallout from that. I also added parser contexts to this error while I was at it.
Fixes #1788.
pr created time in 2 days
issue openededgedb/edgedb
Mark optional types in the AST as Optional
A lot of fields in especially our qlast but also everywhere else are not marked Optional despite being optional.
This causes two big problems:
- We don't get typechecking related to the optionality
- In a bunch of cases mypy will decide that branches are unreachable and not typecheck them at all.
Ideally, mypy would catch that we were putting None into these non-Optional fields, but we have evaded it.
created time in 2 days
issue commentedgedb/edgedb
ISE: 'PointerRef' object has no attribute 'is_scalar'
What is the correct behavior here? Rejecting the query because target is not a link attribute?
comment created time in 2 days
push eventedgedb/edgedb
commit sha d4a3b107f5956f13c09ba1022c16256589b8162c
naming things
push time in 2 days
pull request commentedgedb/edgedb
Restore find_path_output as an optimization
Updated with a fix that I'm not really happy with.
comment created time in 2 days
push eventedgedb/edgedb
commit sha 4bfc5cfa67eecd1cceb0deb39b6f01d4c85eb90e
Disable find_path_output optimization inside UNIONs
push time in 2 days
PR closed edgedb/edgedb
This will fix an issue where fetch something twice for expr and serialized, or similar, including sometimes doing two function calls!
A fix I made in #1762 made find_path_output no longer necessary for correctness, so I removed it, but it will still important as an optimization.
Restore the optimization bit of that code, and add a comment so I don't forget and delete it again ;P.
pr closed time in 2 days
pull request commentedgedb/edgedb
Restore find_path_output as an optimization
Oh, oops. I ran the test suite locally and somehow then forgot it had failed between yesterday and this morning and it is broken. I'm going to close this for now because I think the problem is serious.
comment created time in 2 days
PR opened edgedb/edgedb
This will fix an issue where fetch something twice for expr and serialized, or similar, including sometimes doing two function calls!
A fix I made in #1762 made find_path_output no longer necessary for correctness, so I removed it, but it will still important as an optimization.
Restore the optimization bit of that code, and add a comment so I don't forget and delete it again ;P.
pr created time in 2 days
issue commentedgedb/edgedb
Inconsistency with volatile calls
My intuition about it was that it clearly makes sense according to our semantics that
SELECT (Object, random())should always return the same value (and, in fact, it would be pretty wrong if it didn't!)
Actually, I take this back. The "Iterate over the set of input tuples, and on every iteration evaluate the query expression" semantics does I think imply that it ought to call random() for each row, since there will be an input tuple for each Object. But a query like SELECT ({1,2,3}, random()) would call random() once, because there is only one input tuple.
(This matches what currently happens in my evaluator model.)
Is this a nonstarter in terms of performance/implementation? Anything we need to do we could only do if we detect a volatile, so maybe the hypothetical perf impact isn't that bad, but correlating with every input set seems painful.
So we need to rethink how we specify the semantics, then, too, if our desired (AKA implementable) behavior is somewhere in between what we currently specify and what we implement.
comment created time in 3 days
push eventedgedb/edgedb
commit sha bc97e3ec333302cc26c1e450d74eb8fc99880edd
Fix a bunch of tests I wrote previously to not depend on unspecified order (#1783) * Fix a bunch of tests I wrote previously to not depend on unspecified order * I hate the 79 character limit so badly.
push time in 3 days
PR merged edgedb/edgedb
pr closed time in 3 days
push eventedgedb/edgedb
commit sha d0a5989d4ffbcc84067d712a24d375d4476b2efe
Don't trigger recursion errors on medium-size set literals (#1785) Currently set literals get compiled into a chain of UNIONs, which causes a big blowup in the nesting depth of the AST. As a result, we trip a recursion error on set literals containing 60 one-element tuples, which is a solidly medium-size input. Fix this by compiling set literals into a tree of UNIONs instead of a chain. Fixes #475 to my satisfaction though others may disagree
push time in 3 days
PR merged edgedb/edgedb
Currently set literals get compiled into a chain of UNIONs, which causes a big blowup in the nesting depth of the AST. As a result, we trip a recursion error on set literals containing 60 one-element tuples, which is a solidly medium-size input.
Fix this by compiling set literals into a tree of UNIONs instead of a chain.
Fixes #475 to my satisfaction though others may disagree
pr closed time in 3 days
issue closededgedb/edgedb
RecursionError when compiling unions over many queries
Query to repro:
WITH MODULE test
FOR X IN {
(1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,),
(1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,),
(1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,),
(1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,),
}
UNION 1;
closed time in 3 days
1st1issue commentedgedb/edgedb
Inconsistency with volatile calls
Yeah, I hit this while thinking about #492.
My intuition about it was that it clearly makes sense according to our semantics that SELECT (Object, random()) should always return the same value (and, in fact, it would be pretty wrong if it didn't!), the obvious seeming interpretation of our semantics is that FOR x IN {1, 2, 3} UNION (x, random()) should return different values, and so it should be possible to accomplish whatever we need to do without new syntax. So I figured I'd work through some examples of what workarounds were needed, which would help illuminate to me what is needed from sugar to make it easier.
(Thinking about it a little more, the most obvious reading of our semantics I think also implies that ORDER BY random() ought to work, too, though.)
(There's a plausible semantics where it is always allowed to get factored out, also, but my understanding is there are cases where we need that to not be the case. And it's less nice, IMO.)
comment created time in 3 days
PR opened edgedb/edgedb
Currently set literals get compiled into a chain of UNIONs, which causes a big blowup in the nesting depth of the AST. As a result, we trip a recursion error on set literals containing 60 one-element tuples, which is a solidly medium-size input.
Fix this by compiling set literals into a tree of UNIONs instead of a chain.
Fixes #475 to my satisfaction though others may disagree
pr created time in 3 days
push eventedgedb/edgedb
commit sha f832ac1aaba721802a380483e6661fb15e22d8d8
I hate the 79 character limit so badly.
push time in 3 days
issue commentedgedb/edgedb
RecursionError when compiling unions over many queries
A few things:
- It looks like the error does get serialized properly now
- It's pretty fundamental to what we do that we are going to be recursing over user-provided nested data, so this sort of thing is always a risk
- Python's default recursion limit is 1000, which is really not very big. It's probably worth turning it up.
- If we want to make sure to prevent this sort of thing, one option is to have a check on the original AST that the nesting depth of constructs doesn't exceed some level, and then try not to blow up the nesting level beyond some factor during our compilation passes
- This example in particular blows up the nesting level because we turn the set literal into a linearly deep chain of UNION operators. We could make it logarithmically deep by making it a tree of UNIONs instead of a list. (Though note that this is still incompatible with the above bullet point's suggest strategy which only permits a constant factor blowup.)
So I think my proposed plan for RecursionErrors is:
- Turn up the recursion limit
- Fix anything that seems to gratuitously blow up the nesting depth but otherwise don't worry too much at this stage
(That means fixing this one to not do a linear blowup of set literals)
comment created time in 3 days
issue commentedgedb/edgedb
RecursionError when compiling unions over many queries
Both of these work now, but adding an extra row makes it fail
comment created time in 3 days
issue openededgedb/edgedb
Inconsistency with volatile calls
FOR x IN {1, 2, 3} UNION (x, random());returns identical valuesFOR x IN {1, 2, 3} UNION (SELECT (x, random()));returns different valuesSELECT (FOR x IN {1, 2, 3} UNION (SELECT (x, random())));returns identical values (!)
I /think/ that all 3 ought to return different values but 2 and 3 definitely should do the same thing.
created time in 3 days
issue commentedgedb/edgedb
Polymorphic computables don't work
What is the semantics of this query supposed to be? Currently it doesn't even parse.
comment created time in 3 days
issue commentedgedb/edgedb
Invalid coalescing comparison operator behavior in functions
@elprans is working on a change to use UUIDs as column names, which should fix this
comment created time in 3 days
push eventedgedb/edgedb
commit sha b90ff5d0c6a64ae7c7cbbf22f1fc1dd62f462c2e
Expand the tests for optional function args a bit more (#1782)
push time in 3 days
PR opened edgedb/edgedb
pr created time in 3 days
issue commentedgedb/edgedb
Invalid coalescing comparison operator behavior in functions
An update on this bug:
SELECT test(<optional str>{}); now returns {}, which is correct. For it to return {0}, you would need the parameter to be declared optional.
It looks like the bug is now caused by name conflict: renaming the parameter to something other than nickname makes it work. Argh!
comment created time in 3 days
push eventedgedb/edgedb
commit sha 589a2e6ec0a87625bf798121a96a0f0f0b966fdb
[toy-model] Add an Obj object for representing objects/shapes
commit sha 62d898873ccdeb88ce8e68f66a02714138e57d0f
[toy-model] Some refactoring, make the repl the default
commit sha 129e17e59836b72283cb8bb05248de9aae32048a
[toy-model] Fix link deduplication
commit sha daa40c10cb939b1f122cabe86b11a8b8617aa105
[toy-model] Support SELECT result_alias
commit sha 9b53c8db252934d0efc31cba6cc1d9ec70573efe
[toy-model] Fix SET OF args to unary operators
commit sha 9089e8f7faebafcc7130f271e106e1d3c200c031
[toy-model] Add a lot more functions and operators
commit sha 8c8e01d8bb04589138aab034057789ca06bf1ea7
[toy-model] Write a basic suite of smoke tests
push time in 4 days
issue commentedgedb/edgedb
Incorrect result for a value computed in WITH block
Also: WITH X := {1, 2}, Y := X+1 SELECT (X, Y).
Should produce a cross-product output with 4 results, actually produces 2.
comment created time in 4 days
push eventedgedb/edgedb
commit sha 7bedf02b8deeb29b1a46ba2eeea82003e300e7da
Disallow correlation with iterator set if body contains DML (#1779) Currently we generate invalid SQL, since we would need to lift the correlated set into CTEs, which we don't want to deal with. Fixes #1739.
push time in 4 days
PR merged edgedb/edgedb
Currently we generate invalid SQL, since we would need to lift the correlated set into CTEs, which we don't want to deal with.
Fixes #1739.
(Stacked on top of https://github.com/edgedb/edgedb/pull/1776, can't merge yet)
pr closed time in 4 days
issue closededgedb/edgedb
Properly reject correlation with FOR iterator containing DML
We should reject queries like SELECT (Person, (FOR x in {Person} UNION ((INSERT Note {name := x.name}))));
Currently we generate invalid SQL.
closed time in 4 days
msullivanpush eventedgedb/edgedb
commit sha d2d90e89355fb8d8f09e3a0c085d5d7eaa794484
Support partial paths in object constraints (#1774) Fixes #1704.
commit sha 747ee86b4ad59baf71913b5ccdf9155cb76fb189
Fix INSERT-OR-SELECT when combined with shape (#1775) Fixes #1743.
commit sha 3d7b2cb9d93ea85bd1ce00bc177cd6e65ca4d345
Make sure FOR iterator statement correlates correctly (#1776) This fixes an issue introduced in #1757, where declaring a view for the iterator was done in a temporary scope in a way such that we lost the tree modifications. It turns out the real culprit is an unnecessary extra fence, so drop that.
commit sha 078f0544b94e1455b73029123561fe090343a808
Disallow correlation with iterator set if body contains DML Currently we generate invalid SQL, since we would need to lift the correlated set into CTEs, which we don't want to deal with. Fixes #1739.
commit sha b7e85c23f128e26f0d6d3788f087d01ecca1e321
types were a mistake
commit sha 37aed07abc962dad55fb6724037c89efa6231a1d
a more deeply nested test
push time in 4 days
push eventedgedb/edgedb
commit sha 3d7b2cb9d93ea85bd1ce00bc177cd6e65ca4d345
Make sure FOR iterator statement correlates correctly (#1776) This fixes an issue introduced in #1757, where declaring a view for the iterator was done in a temporary scope in a way such that we lost the tree modifications. It turns out the real culprit is an unnecessary extra fence, so drop that.
push time in 4 days
PR merged edgedb/edgedb
This fixes an issue introduced in #1757, where declaring a view for the iterator was done in a temporary scope so we lost the tree modifications.
pr closed time in 4 days
PR opened edgedb/edgedb
Currently we generate invalid SQL, since we would need to lift the correlated set into CTEs, which we don't want to deal with.
Fixes #1739.
(Stacked on top of https://github.com/edgedb/edgedb/pull/1776, can't merge yet)
pr created time in 4 days
Pull request review commentedgedb/edgedb
Make sure FOR iterator statement correlates correctly
def compile_ForQuery( iterator_view = stmtctx.declare_view( iterator, qlstmt.iterator_alias,- path_id_namespace=path_id_ns, ctx=scopectx)+ new_namespace=False,+ path_id_namespace=path_id_ns,+ ctx=iterator_ctx or scopectx)
Great catch.
I did that, and threw some slight refactoring/rearrangement in because dropping such a big chunk of code into the same nesting level without any visual breaks was giving me the willies :P
comment created time in 4 days
push eventedgedb/edgedb
commit sha e7a2cf7caeeed6a77a07fcb746c9b1f83a5a2fb5
Run it back
commit sha fd15d85824f822bb097d53b6432aa7cccf09ceb0
Some refactoring
push time in 4 days
issue commentedgedb/edgedb
Disallow overloading SINGLETON/SET OF/OPTIONAL based on type?
Maybe it's also better to disallow overloading the number of positional arguments at all?
I think I am against prohibiting overloading the number of arguments, though that is also something I could easily see myself on the other side of.
If the proposal is disallow making SINGLETON/SET OF/OPTIONAL decisions based on the number of arguments, that is pretty reasonable and might be better than my original proposal. Then the type mod of any parameter would be uniquely determined by the function and its argument position/name.
Additional knock on effects in the standard library are that std::to_datetime() would need some tweaking but that is it.
comment created time in 4 days
issue commentedgedb/edgedb
Disallow overloading SINGLETON/SET OF/OPTIONAL based on type?
I'm not sure what you propose here. To have placeholder values in those cases, or create another modifier that can be omitted but can't be an empty set? Probably latter can fix the issue I've decsribed above, but that's another quirk of the language.
@msullivan proposes to prohibit this: [...]
~My question was specifically for this part of the proposal:~ Aha, I see we actually do differntiate between OPTIONAL arguments and arguments having a default values that can be omitted, but are not OPTIONAL...
A lot of the OPTIONAL arguments aren't really OPTIONAL, I think, also; the optionality is just there to be a default value for a parameter and probably nobody ever plans to pass a potentially empty set in.
I think I was somewhat unclear here: this sentence was really just an observation, and doesn't have any proposal attached to it. This was not really
comment created time in 4 days
issue openededgedb/edgedb
Disallow overloading SINGLETON/SET OF/OPTIONAL based on type?
Currently type-based function overloading is allowed to select argument type modifiers (SINGLETON/SET OF/OPTIONAL). There is substantial complexity in edb/edgeql/compiler/func.py and the scope tree to handle this (a bunch added recently, in #1762).
I think that argument type modifiers (SET OF, in particular, which induces subqueries) affect the semantics of the query enough that it should be easy and straightforward to determine them.
I propose that we require that all function overloads with matching signatures (number of positional args + names of name only arguments) have the same type modifiers. We can then decide which type modifiers to use based on just the function signature, before we necessarily know the types, and then figure out which exact instance later. (I wouldn't mind banning overloading SET OF here, either, since SET OF is a big deal, but I don't have any technical arguments.)
This will let us clean up function compilation to be able to know the argument kind in advance. (We could also accomplish this by having a typechecker that directly typechecks EdgeQL in advance, which I think is probably a good idea either way but is also probably a bunch of work.) It also means that an evaluation model can get away without needing to do a static typecheck. (I think. There might be other problems.)
There are currently 4 offending functions in the stdlib:
std::to_str (the deprecated array overload) and cal::to_local_{datetime,date,time}.
They can all be fixed without much trouble. (The second argument to the array overload for to_str can be made optional, though it is deprecated and being removed anyway, and the cal functions can have the fmt argument made named only, or made non-OPTIONAL and given a default of "" or something).
A lot of the OPTIONAL arguments aren't really OPTIONAL, I think, also; the optionality is just there to be a default value for a parameter and probably nobody ever plans to pass a potentially empty set in.
created time in 5 days
push eventedgedb/edgedb
commit sha 4d60fe568b677417bc353587499724e768cd2143
tweak ctx
push time in 5 days
PR opened msolo/git-mg
git-config appears to lowercase keys before returning them, which meant sync.excludePaths and friends weren't getting found. Look them up lowercased, instead.
I'm not sure if this is a change in behavior on git's side (it does this as of 2.20.1, at least), so to make sure, lowercase it outselves at the ingestion point.
pr created time in 5 days
Pull request review commentedgedb/edgedb
Make sure FOR iterator statement correlates correctly
def compile_ForQuery( iterator_view = stmtctx.declare_view( iterator, qlstmt.iterator_alias,+ temporary=False,
OK, I'll try that. Basically every single thing about this PR has changed since that version, though :P
comment created time in 5 days
push eventedgedb/edgedb
commit sha 747ee86b4ad59baf71913b5ccdf9155cb76fb189
Fix INSERT-OR-SELECT when combined with shape (#1775) Fixes #1743.
push time in 5 days
issue closededgedb/edgedb
Insert-or-select fails when it's combined with a shape.
- EdgeDB Version: EdgeDB 1.0-alpha.6+dev.5050.gb8aa1c99
- OS Version: Linux
Steps to Reproduce:
CREATE TYPE default::Foo {
CREATE OPTIONAL SINGLE PROPERTY name -> std::str {
CREATE CONSTRAINT std::exclusive;
};
};
CREATE TYPE default::Bar {
CREATE REQUIRED SINGLE LINK foo -> default::Foo;
};
INSERT Foo {name := 'foo0'};
Then the following happens:
victor> SELECT (INSERT Bar {foo := (INSERT Foo {name := 'foo0'} UNLESS CONFLICT ON .name ELSE (SELECT Foo))}) {id};
{Object {id: 948f4c8e-ed81-11ea-955a-5b32015497c5}}
victor> SELECT (INSERT Bar {foo := (INSERT Foo {name := 'foo0'} UNLESS CONFLICT ON .name ELSE (SELECT Foo))}) {id, foo};
ERROR: InternalServerError: more than one row returned by a subquery used as an expression
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
edb.errors.InternalServerError: more than one row returned by a subquery used as an expression
So it's not that the cardinality check fails, it's that the SQL causes an effect similar to a cardinality problem if foo is included in the final shape to be returned.
closed time in 5 days
vpetrovykhpush eventedgedb/edgedb
commit sha 2db9fe05d736baca442aac6d87433e349ed284c9
Rework it to still use a temp scope but to skip namespaces
push time in 5 days
push eventedgedb/edgedb
commit sha 43b86abfad9e9e3f1e29fefe0d384d0e5b05790c
[toy-model] Implement FOR and WITH
push time in 5 days
Pull request review commentedgedb/edgedb
Fix INSERT-OR-SELECT when combined with shape
def fini_dml_stmt( # referencing this class yields the expected results. dml_stack = get_dml_stmt_stack(ir_stmt, ctx=ctx) if isinstance(ir_stmt, irast.InsertStmt):+ # The union CTE might have a SELECT from an ELSE clause, which+ # we don't actually want to include.+ assert len(parts.dml_ctes) == 1+ cte = next(iter(parts.dml_ctes.values()))[0] relctx.add_type_rel_overlay(- ir_stmt.subject.typeref, 'union', union_cte,+ ir_stmt.subject.typeref, 'unIon', cte,
This branch is only for INSERTs. The assert should always be true.
comment created time in 5 days
push eventedgedb/edgedb
commit sha 04d15a0433ac878bb3e444f166bf0fb846e9d6e6
Update edb/pgsql/compiler/dml.py oops Co-authored-by: Elvis Pranskevichus <[email protected]>
push time in 5 days
Pull request review commentedgedb/edgedb
Fix INSERT-OR-SELECT when combined with shape
def fini_dml_stmt( # referencing this class yields the expected results. dml_stack = get_dml_stmt_stack(ir_stmt, ctx=ctx) if isinstance(ir_stmt, irast.InsertStmt):+ # The union CTE might have a SELECT from an ELSE clause, which+ # we don't actually want to include.+ assert len(parts.dml_ctes) == 1+ cte = next(iter(parts.dml_ctes.values()))[0] relctx.add_type_rel_overlay(- ir_stmt.subject.typeref, 'union', union_cte,+ ir_stmt.subject.typeref, 'unIon', cte,
Oops on the unIon! I added that to make sure this is where a particular union in the generated code was coming from :P
comment created time in 5 days
push eventedgedb/edgedb
commit sha d2d90e89355fb8d8f09e3a0c085d5d7eaa794484
Support partial paths in object constraints (#1774) Fixes #1704.
push time in 5 days
issue closededgedb/edgedb
Omitting `__subject__` in constraints on object types fails.
Steps to Reproduce:
EdgeDB 1.0-alpha.4+dev.145.g4d9ce642
Type "\?" for help.
victor>
victor>
victor> create type Vector {
....... create required property x -> float64;
....... create required property y -> float64;
....... };
OK: CREATE
victor> alter type Vector { create constraint expression on (.x^2 + .y^2 < 25) };
error: could not resolve partial path
┌─ query:1:54
│
1 │ alter type Vector { create constraint expression on (.x^2 + .y^2 < 25) };
│ ^^^ error
Ideally, the short path should assume __subject__ as its start.
closed time in 5 days
vpetrovykhpull request commentedgedb/edgedb
Make sure FOR iterator statement correlates correctly
OK this isn't right yet, since WITH X := {1, 2} SELECT ((FOR x in {X} UNION (SELECT x)), X); still computes a cross product, although that bug predates the original one.
comment created time in 5 days
PR opened edgedb/edgedb
This fixes an issue introduced in #1757, where declaring a view for the iterator was done in a temporary scope so we lost the tree modifications.
pr created time in 5 days
issue commentedgedb/edgedb
Properly reject correlation with FOR iterator containing DML
https://github.com/edgedb/edgedb/pull/1757/ made this succeed by losing the correlation between the two Persons, which is also a bug!
comment created time in 5 days
push eventedgedb/edgedb
commit sha 6f5add48acc628ef91e8fc541e357c1b1f78a72a
Support partial paths in object constraints Fixes #1704.
push time in 5 days
PR opened edgedb/edgedb
This patch errs on the side of disallowing, since it is pretty easy to workaround.
We allow DML when the source is filtered, comes from a query that is not a set reference, when it is a FOR iterator, and when it is the set being inserted in the ELSE clause of INSERT ... ELSE. (FOR is allowed because the meaning seems to clearly imply applying to everything ...and because it made the implementation easy.)
Most of the test cases for things we allow are existing ones.
I can follow up with a documentation update if there is agreement on this one.
Closes #1742.
pr created time in 5 days
push eventedgedb/edgedb
commit sha ef184603b6fabd4673f922ccfd80d02db77dcb34
Disallow DELETE and UPDATE in many cases without FILTER
push time in 5 days
push eventedgedb/edgedb
commit sha 2d9945ef0c1c59d68dea0d3ad40b0e340fee5ba4
[toy-model] Implement SELECT clauses
commit sha ad58aba2a5d087967df4bfd93c38ca6981678fdd
[toy-model] Implement FOR and WITH
push time in 5 days
push eventedgedb/edgedb
commit sha e78a2870bb29ffcc2b586be3a836ea512fee6250
[toy-model] Keep going on an exception in the REPL
commit sha 9baf8ab1f2f2361002d10ea40ef4083873b5956b
[toy-model] Named tuple literals and tuple projection
commit sha 5a4f145d17e7f7ef7906d39745eb07c74b55e93d
[toy-model] Unary ops
push time in 6 days
push eventedgedb/edgedb
commit sha 3fa174ece09a2e25044d2161154ccad8102dda4f
[toy-model] Search for common prefixes in subqueries
push time in 8 days