From 3f2493554c5575b06ffab2eee379cde86eacbbd3 Mon Sep 17 00:00:00 2001
From: Catalin Iacob <iacobcatalin@gmail.com>
Date: Mon, 29 Feb 2016 07:10:41 +0100
Subject: [PATCH 1/5] Comment improvements

---
 src/pl/plpython/expected/plpython_test.out | 4 ++--
 src/pl/plpython/plpy_spi.c                 | 4 +++-
 src/pl/plpython/sql/plpython_test.sql      | 4 ++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/pl/plpython/expected/plpython_test.out b/src/pl/plpython/expected/plpython_test.out
index c385256..4817022 100644
--- a/src/pl/plpython/expected/plpython_test.out
+++ b/src/pl/plpython/expected/plpython_test.out
@@ -135,7 +135,7 @@ CONTEXT:  PL/Python anonymous code block
 do $$ plpy.info('unsupported argument', blabla='fooboo') $$ LANGUAGE plpythonu;
 ERROR:  'blabla' is an invalid keyword argument for this function
 CONTEXT:  PL/Python anonymous code block
--- raise exception i n python, handle exception in plgsql
+-- raise exception in python, handle exception in plgsql
 CREATE OR REPLACE FUNCTION raise_exception(_message text, _detail text DEFAULT NULL, _hint text DEFAULT NULL,
 						_sqlstate text DEFAULT NULL,
 						_schema text DEFAULT NULL, _table text DEFAULT NULL, _column text DEFAULT NULL,
@@ -231,7 +231,7 @@ $$;
 NOTICE:  handled exception
 DETAIL:  message:(plpy.Error: message text), detail:(detail text), hint: (hint text), sqlstate: (XX555), schema:(schema text), table:(table text), column:(column text), datatype:(datatype text), constraint:(constraint text)
 -- the displayed context is different between Python2 and Python3,
--- but for this test is not important.
+-- but that's not important for this test
 \set SHOW_CONTEXT never
 do $$
 try:
diff --git a/src/pl/plpython/plpy_spi.c b/src/pl/plpython/plpy_spi.c
index 6cdbd23..2d9892f 100644
--- a/src/pl/plpython/plpy_spi.c
+++ b/src/pl/plpython/plpy_spi.c
@@ -536,7 +536,9 @@ PLy_spi_subtransaction_abort(MemoryContext oldcontext, ResourceOwner oldowner)
 	/* Look up the correct exception */
 	entry = hash_search(PLy_spi_exceptions, &(edata->sqlerrcode),
 						HASH_FIND, NULL);
-	/* Now, the exception with custom code can come */
+	/* This could be a custom error code, if that's the case fallback to
+	 * SPIError
+	 */
 	exc = entry ? entry->exc : PLy_exc_spi_error;
 	/* Make Python raise the exception */
 	PLy_spi_exception_set(exc, edata);
diff --git a/src/pl/plpython/sql/plpython_test.sql b/src/pl/plpython/sql/plpython_test.sql
index 6f59cab..5b39330 100644
--- a/src/pl/plpython/sql/plpython_test.sql
+++ b/src/pl/plpython/sql/plpython_test.sql
@@ -91,7 +91,7 @@ $$ LANGUAGE plpythonu;
 do $$ plpy.info('wrong sqlstate', sqlstate='54444A') $$ LANGUAGE plpythonu;
 do $$ plpy.info('unsupported argument', blabla='fooboo') $$ LANGUAGE plpythonu;
 
--- raise exception i n python, handle exception in plgsql
+-- raise exception in python, handle exception in plgsql
 CREATE OR REPLACE FUNCTION raise_exception(_message text, _detail text DEFAULT NULL, _hint text DEFAULT NULL,
 						_sqlstate text DEFAULT NULL,
 						_schema text DEFAULT NULL, _table text DEFAULT NULL, _column text DEFAULT NULL,
@@ -164,7 +164,7 @@ END;
 $$;
 
 -- the displayed context is different between Python2 and Python3,
--- but for this test is not important.
+-- but that's not important for this test
 \set SHOW_CONTEXT never
 
 do $$
-- 
2.7.1

