@@ -1543,12 +1543,10 @@ def __init__(self, ident, database, description = ()):
15431543 if isinstance (ident , int ):
15441544 proctup = database .prepare (
15451545 ProcedureLookup + ' WHERE pg_proc.oid = $1' ,
1546- title = 'func_lookup_by_oid'
15471546 ).first (int (ident ))
15481547 else :
15491548 proctup = database .prepare (
15501549 ProcedureLookup + ' WHERE pg_proc.oid = regprocedurein($1)' ,
1551- title = 'func_lookup_by_name'
15521550 ).first (ident )
15531551 if proctup is None :
15541552 raise LookupError ("no function with identifier %s" % (str (ident ),))
@@ -1617,7 +1615,6 @@ def __getitem__(self, i):
16171615 db = self .database
16181616 r = db .prepare (
16191617 "SELECT setting FROM pg_settings WHERE name = $1" ,
1620- title = 'lookup_setting_by_name'
16211618 )(i ).read ()
16221619
16231620 if r :
@@ -1633,7 +1630,6 @@ def __setitem__(self, i, v):
16331630
16341631 setas = self .database .prepare (
16351632 "SELECT set_config($1, $2, false)" ,
1636- title = 'set_setting' ,
16371633 ).first (i , v )
16381634 self .cache [i ] = setas
16391635
@@ -1675,7 +1671,6 @@ def get(self, k, alt = None):
16751671 db = self .database
16761672 r = db .prepare (
16771673 "SELECT setting FROM pg_settings WHERE name = $1" ,
1678- title = 'lookup_setting_by_name'
16791674 )(k ).read ()
16801675 if r :
16811676 v = r [0 ][0 ]
@@ -1697,7 +1692,6 @@ def getset(self, keys):
16971692 if rkeys :
16981693 r = self .database .prepare (
16991694 "SELECT name, setting FROM pg_settings WHERE name = ANY ($1)" ,
1700- title = 'lookup_settings_by_name'
17011695 )(rkeys ).read ()
17021696 self .cache .update (r )
17031697 setmap .update (r )
@@ -1709,22 +1703,19 @@ def getset(self, keys):
17091703 def keys (self ):
17101704 for x , in self .database .prepare (
17111705 "SELECT name FROM pg_settings ORDER BY name" ,
1712- title = 'get_setting_names'
17131706 ):
17141707 yield x
17151708 __iter__ = keys
17161709
17171710 def values (self ):
17181711 for x , in self .database .prepare (
17191712 "SELECT setting FROM pg_settings ORDER BY name" ,
1720- title = 'get_setting_values'
17211713 ):
17221714 yield x
17231715
17241716 def items (self ):
17251717 return self .database .prepare (
17261718 "SELECT name, setting FROM pg_settings ORDER BY name" ,
1727- title = 'get_settings'
17281719 )
17291720
17301721 def update (self , d ):
@@ -1733,7 +1724,6 @@ def update(self, d):
17331724 "SELECT ($1::text[][])[i][1] AS key, " \
17341725 "set_config(($1::text[][])[i][1], $1[i][2], false) AS value " \
17351726 "FROM generate_series(1, array_upper(($1::text[][]), 1)) g(i)" ,
1736- title = 'update_settings'
17371727 )(kvl ))
17381728
17391729 def _notify (self , msg ):
@@ -1808,10 +1798,10 @@ def __exit__(self, typ, value, tb):
18081798 if self .database ._pq_state == b'E' :
18091799 err = pg_exc .InFailedTransactionError (
18101800 "invalid transaction block exit detected" ,
1811- source = 'DRIVER ' ,
1801+ source = 'CLIENT ' ,
18121802 details = {
1813- 'DRIVER ' : \
1814- 'Connection was in an error-state, ' \
1803+ 'cause ' : \
1804+ 'Database was in an error-state, ' \
18151805 'but no exception was raised.'
18161806 },
18171807 )
@@ -1843,7 +1833,7 @@ def __exit__(self, typ, value, tb):
18431833 #
18441834 # But the occurrence of this exception means it's not in an active
18451835 # transaction, which means no cleanup other than raise is necessary.
1846- err .details ['DRIVER ' ] = \
1836+ err .details ['cause ' ] = \
18471837 "The prepared transaction was not " \
18481838 "prepared prior to the block's exit."
18491839 raise
@@ -1897,7 +1887,7 @@ def start(self):
18971887 err = pg_exc .OperationError (
18981888 "transactions cannot be restarted" ,
18991889 details = {
1900- 'DRIVER ' : \
1890+ 'hint ' : \
19011891 'Create a new transaction object instead of re-using an old one.'
19021892 }
19031893 )
@@ -1916,7 +1906,7 @@ def start(self):
19161906 err = pg_exc .OperationError (
19171907 "configured transaction used inside a transaction block" ,
19181908 details = {
1919- 'hint ' : 'A transaction block was already started.'
1909+ 'cause ' : 'A transaction block was already started.'
19201910 }
19211911 )
19221912 self .ife_descend (err )
@@ -1968,7 +1958,7 @@ def recover(self):
19681958 else :
19691959 err = pg_exc .UndefinedObjectError (
19701960 "prepared transaction does not exist" ,
1971- source = 'DRIVER ' ,
1961+ source = 'CLIENT ' ,
19721962 )
19731963 self .ife_descend (err )
19741964 err .raise_exception ()
@@ -1978,11 +1968,7 @@ def commit(self):
19781968 return
19791969 if self .state not in ('prepared' , 'open' ):
19801970 err = pg_exc .OperationError (
1981- "commit attempted on transaction with unexpected state" ,
1982- details = {
1983- 'DRIVER' : "Transaction was " + repr (self .state ) + \
1984- " , but it must be 'prepared' or 'open' in order to commit."
1985- }
1971+ "commit attempted on transaction with unexpected state, " + repr (self .state ),
19861972 )
19871973 self .ife_descend (err )
19881974 err .raise_exception ()
@@ -1998,8 +1984,7 @@ def commit(self):
19981984 err = pg_exc .OperationError (
19991985 "savepoint configured with global identifier" ,
20001986 details = {
2001- 'DRIVER' : \
2002- "Don't configure savepoint transactions with global identifiers."
1987+ 'cause' : "Prepared transaction started inside transaction block?"
20031988 }
20041989 )
20051990 self .ife_descend (err )
@@ -2017,10 +2002,8 @@ def rollback(self):
20172002 return
20182003 if self .state not in ('prepared' , 'open' ):
20192004 err = pg_exc .OperationError (
2020- "aborted attempted on transaction with unexpected state" ,
2021- details = {
2022- 'hint' : "Transactions cannot be re-used."
2023- }
2005+ "aborted attempted on transaction with unexpected state, " \
2006+ + repr (self .state ),
20242007 )
20252008 self .ife_descend (err )
20262009 err .raise_exception ()
@@ -2192,7 +2175,6 @@ def xact(self, gid = None, isolation = None, mode = None):
21922175 def prepare (self ,
21932176 sql_statement_string : str ,
21942177 statement_id = None ,
2195- title = None ,
21962178 ) -> PreparedStatement :
21972179 ps = PreparedStatement .from_string (sql_statement_string , self )
21982180 self .ife_descend (ps )
@@ -2295,7 +2277,7 @@ def connect(self, timeout = None):
22952277 details = {
22962278 "severity" : "FATAL" ,
22972279 },
2298- source = 'DRIVER '
2280+ source = 'CLIENT '
22992281 )
23002282 self .ife_descend (err )
23012283 err .database = self
@@ -2350,7 +2332,7 @@ def connect(self, timeout = None):
23502332 # probably not PQv3..
23512333 raise pg_exc .ProtocolError (
23522334 "server did not support SSL negotiation" ,
2353- source = 'DRIVER ' ,
2335+ source = 'CLIENT ' ,
23542336 details = {
23552337 'hint' : \
23562338 'The server is probably not PostgreSQL.'
@@ -2361,7 +2343,7 @@ def connect(self, timeout = None):
23612343 raise pg_exc .InsecurityError (
23622344 "`sslmode` required a secure connection, " \
23632345 "but was unsupported by server" ,
2364- source = 'DRIVER '
2346+ source = 'CLIENT '
23652347 )
23662348 if supported :
23672349 self .socket = self .connector .socket_secure (self .socket )
@@ -2414,7 +2396,7 @@ def connect(self, timeout = None):
24142396 "severity" : "FATAL" ,
24152397 },
24162398 # It's really a sequence of exceptions.
2417- source = 'DRIVER '
2399+ source = 'CLIENT '
24182400 )
24192401 self .ife_descend (err )
24202402 err .database = self
0 commit comments