Skip to content

Commit

Permalink
Add default typecast for sql_identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Aug 26, 2023
1 parent 538bb9f commit 8a358e1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/contents/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ Version 5.2.5 (to be released)
- This version officially supports the new Python 3.11 and PostgreSQL 15.
- Two more improvements in the `inserttable()` method of the `pg` module
(thanks to Justin Pryzby for this contribution):

- error handling has been improved (#72)
- the method now returns the number of inserted rows (#73)
- Another improvement in the `pg` module (#83):
- generated columns can be requested with the `get_generated()` method
- generated columns are ignored by the insert, update and upsert method
- Avoid internal query and error when casting the `sql_identifier` type (#82)

Version 5.2.4 (2022-03-26)
--------------------------
Expand Down
2 changes: 1 addition & 1 deletion pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ class Typecasts(dict):
# (str functions are ignored but have been added for faster access)
defaults = {
'char': str, 'bpchar': str, 'name': str,
'text': str, 'varchar': str,
'text': str, 'varchar': str, 'sql_identifier': str,
'bool': cast_bool, 'bytea': unescape_bytea,
'int2': int, 'int4': int, 'serial': int, 'int8': long, 'oid': int,
'hstore': cast_hstore, 'json': cast_json, 'jsonb': cast_json,
Expand Down
2 changes: 1 addition & 1 deletion pgdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ class Typecasts(dict):
# (str functions are ignored but have been added for faster access)
defaults = {
'char': str, 'bpchar': str, 'name': str,
'text': str, 'varchar': str,
'text': str, 'varchar': str, 'sql_identifier': str,
'bool': cast_bool, 'bytea': unescape_bytea,
'int2': int, 'int4': int, 'serial': int, 'int8': long, 'oid': int,
'hstore': cast_hstore, 'json': jsondecode, 'jsonb': jsondecode,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_classic_dbwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4899,7 +4899,7 @@ def testMunging(self):
else:
self.assertNotIn('oid(t)', r)

def testQeryInformationSchema(self):
def testQueryInformationSchema(self):
q = "column_name"
if self.db.server_version < 110000:
q += "::text" # old version does not have sql_identifier array
Expand Down

0 comments on commit 8a358e1

Please sign in to comment.