Skip to content

Commit

Permalink
Merge from v4
Browse files Browse the repository at this point in the history
  • Loading branch information
lelit committed Feb 28, 2023
2 parents 1fc1655 + 57b1a73 commit 620ea50
Show file tree
Hide file tree
Showing 10 changed files with 729 additions and 1,873 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true

build_wheels:
name: Build wheels on ${{ matrix.arch }} for ${{ matrix.os }}
Expand Down
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ Version 5
Version 4
#########

4.2 (2023-02-27)
~~~~~~~~~~~~~~~~

- Handle special syntax required by ``SET TIME ZONE INTERVAL '-08:00' hour to minute``

- Fix mistype mapping of raw C "long" and "double" attributes, that were decorated with the
wrong Python type


4.1 (2022-12-19)
~~~~~~~~~~~~~~~~

Expand Down
7 changes: 7 additions & 0 deletions docs/dml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,13 @@

Pretty print a `node` of type `TypeName <https://github.com/pganalyze/libpg_query/blob/fc5775e/src/postgres/include/nodes/parsenodes.h#L224>`__ to the `output` stream.

.. index::
pair: VariableSetStmt;TypeCast

.. function:: variable_set_stmt_type_cast(node, output)

Pretty print a `node` of type `TypeCast <https://github.com/pganalyze/libpg_query/blob/fc5775e/src/postgres/include/nodes/parsenodes.h#L325>`__, when it is inside a `VariableSetStmt <https://github.com/pganalyze/libpg_query/blob/fc5775e/src/postgres/include/nodes/parsenodes.h#L2212>`__, to the `output` stream.

.. index:: UpdateStmt

.. function:: update_stmt(node, output)
Expand Down
14 changes: 9 additions & 5 deletions pglast/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -4120,7 +4120,7 @@ def adaptor(value):
adaptor = str
elif ctype == 'char*':
ptype = str
elif ctype in ('Expr*', 'Node*'):
elif ctype in {'Expr*', 'Node*'}:
ptype = (dict, list, tuple, Node)

def adaptor(value):
Expand All @@ -4133,10 +4133,10 @@ def adaptor(value):
else i
for i in value)
return value
elif ctype in ('int', 'int16', 'bits32', 'int32', 'uint32', 'uint64',
'AttrNumber', 'AclMode', 'Index', 'SubTransactionId'):
elif ctype in {'int', 'int16', 'bits32', 'int32', 'long', 'uint32', 'uint64',
'AttrNumber', 'AclMode', 'Index', 'SubTransactionId'}:
ptype = int
elif ctype in ('Cardinality', 'Cost'):
elif ctype in {'Cardinality', 'Cost'}:
ptype = float
elif ctype == 'CreateStmt':
ptype = (dict, CreateStmt)
Expand Down Expand Up @@ -4165,9 +4165,13 @@ def adaptor(value):
if ctype.endswith('*'):
ptype = G.get(ctype[:-1])
if ptype is None:
raise NotImplementedError(f'unknown {ctype!r}') from None
aname = f'{cls.__name__}.{attr}'
raise NotImplementedError(f'Unhandled C type of {aname}: {ctype}')
else:
ptype = (dict, ptype)
else:
aname = f'{cls.__name__}.{attr}'
raise NotImplementedError(f'Unhandled C type of {aname}: {ctype}')
slots[attr] = SlotTypeInfo(ctype, ptype, adaptor)


Expand Down
Loading

0 comments on commit 620ea50

Please sign in to comment.