mirror of
https://github.com/postgres/postgres.git
synced 2025-08-09 17:03:00 +03:00
Improve style guideline compliance of assorted error-report messages.
Per the project style guide, details and hints should have leading capitalization and end with a period. On the other hand, errcontext should not be capitalized and should not end with a period. To support well formatted error contexts in dblink, extend dblink_res_error() to take a format+arguments rather than a hardcoded string. Daniel Gustafsson Discussion: https://postgr.es/m/B3C002C8-21A0-4F53-A06E-8CAB29FCF295@yesql.se
This commit is contained in:
@@ -155,7 +155,7 @@ WHERE t.a > 7;
|
||||
-- open a cursor with bad SQL and fail_on_error set to false
|
||||
SELECT dblink_open('rmt_foo_cursor','SELECT * FROM foobar',false);
|
||||
NOTICE: relation "foobar" does not exist
|
||||
CONTEXT: Error occurred on dblink connection named "unnamed": could not open cursor.
|
||||
CONTEXT: while opening cursor "rmt_foo_cursor" on unnamed dblink connection
|
||||
dblink_open
|
||||
-------------
|
||||
ERROR
|
||||
@@ -223,7 +223,7 @@ FROM dblink_fetch('rmt_foo_cursor',4) AS t(a int, b text, c text[]);
|
||||
SELECT *
|
||||
FROM dblink_fetch('rmt_foobar_cursor',4,false) AS t(a int, b text, c text[]);
|
||||
NOTICE: cursor "rmt_foobar_cursor" does not exist
|
||||
CONTEXT: Error occurred on dblink connection named "unnamed": could not fetch from cursor.
|
||||
CONTEXT: while fetching from cursor "rmt_foobar_cursor" on unnamed dblink connection
|
||||
a | b | c
|
||||
---+---+---
|
||||
(0 rows)
|
||||
@@ -238,7 +238,7 @@ SELECT dblink_exec('ABORT');
|
||||
-- close the wrong cursor
|
||||
SELECT dblink_close('rmt_foobar_cursor',false);
|
||||
NOTICE: cursor "rmt_foobar_cursor" does not exist
|
||||
CONTEXT: Error occurred on dblink connection named "unnamed": could not close cursor.
|
||||
CONTEXT: while closing cursor "rmt_foobar_cursor" on unnamed dblink connection
|
||||
dblink_close
|
||||
--------------
|
||||
ERROR
|
||||
@@ -248,12 +248,12 @@ CONTEXT: Error occurred on dblink connection named "unnamed": could not close c
|
||||
SELECT *
|
||||
FROM dblink_fetch('rmt_foo_cursor',4) AS t(a int, b text, c text[]);
|
||||
ERROR: cursor "rmt_foo_cursor" does not exist
|
||||
CONTEXT: Error occurred on dblink connection named "unnamed": could not fetch from cursor.
|
||||
CONTEXT: while fetching from cursor "rmt_foo_cursor" on unnamed dblink connection
|
||||
-- this time, 'cursor "rmt_foo_cursor" not found' as a notice
|
||||
SELECT *
|
||||
FROM dblink_fetch('rmt_foo_cursor',4,false) AS t(a int, b text, c text[]);
|
||||
NOTICE: cursor "rmt_foo_cursor" does not exist
|
||||
CONTEXT: Error occurred on dblink connection named "unnamed": could not fetch from cursor.
|
||||
CONTEXT: while fetching from cursor "rmt_foo_cursor" on unnamed dblink connection
|
||||
a | b | c
|
||||
---+---+---
|
||||
(0 rows)
|
||||
@@ -316,7 +316,7 @@ FROM dblink('SELECT * FROM foo') AS t(a int, b text, c text[]);
|
||||
SELECT *
|
||||
FROM dblink('SELECT * FROM foobar',false) AS t(a int, b text, c text[]);
|
||||
NOTICE: relation "foobar" does not exist
|
||||
CONTEXT: Error occurred on dblink connection named "unnamed": could not execute query.
|
||||
CONTEXT: while executing query on unnamed dblink connection
|
||||
a | b | c
|
||||
---+---+---
|
||||
(0 rows)
|
||||
@@ -340,7 +340,7 @@ WHERE a = 11;
|
||||
-- botch a change to some other data
|
||||
SELECT dblink_exec('UPDATE foobar SET f3[2] = ''b99'' WHERE f1 = 11',false);
|
||||
NOTICE: relation "foobar" does not exist
|
||||
CONTEXT: Error occurred on dblink connection named "unnamed": could not execute command.
|
||||
CONTEXT: while executing command on unnamed dblink connection
|
||||
dblink_exec
|
||||
-------------
|
||||
ERROR
|
||||
@@ -400,7 +400,7 @@ SELECT *
|
||||
FROM dblink('myconn','SELECT * FROM foobar',false) AS t(a int, b text, c text[])
|
||||
WHERE t.a > 7;
|
||||
NOTICE: relation "foobar" does not exist
|
||||
CONTEXT: Error occurred on dblink connection named "myconn": could not execute query.
|
||||
CONTEXT: while executing query on dblink connection named "myconn"
|
||||
a | b | c
|
||||
---+---+---
|
||||
(0 rows)
|
||||
@@ -437,7 +437,7 @@ SELECT dblink_disconnect('myconn2');
|
||||
-- open a cursor incorrectly
|
||||
SELECT dblink_open('myconn','rmt_foo_cursor','SELECT * FROM foobar',false);
|
||||
NOTICE: relation "foobar" does not exist
|
||||
CONTEXT: Error occurred on dblink connection named "myconn": could not open cursor.
|
||||
CONTEXT: while opening cursor "rmt_foo_cursor" on dblink connection named "myconn"
|
||||
dblink_open
|
||||
-------------
|
||||
ERROR
|
||||
@@ -523,7 +523,7 @@ SELECT dblink_close('myconn','rmt_foo_cursor');
|
||||
-- this should fail because there is no open transaction
|
||||
SELECT dblink_exec('myconn','DECLARE xact_test CURSOR FOR SELECT * FROM foo');
|
||||
ERROR: DECLARE CURSOR can only be used in transaction blocks
|
||||
CONTEXT: Error occurred on dblink connection named "myconn": could not execute command.
|
||||
CONTEXT: while executing command on dblink connection named "myconn"
|
||||
-- reset remote transaction state
|
||||
SELECT dblink_exec('myconn','ABORT');
|
||||
dblink_exec
|
||||
@@ -573,7 +573,7 @@ FROM dblink_fetch('myconn','rmt_foo_cursor',4) AS t(a int, b text, c text[]);
|
||||
SELECT *
|
||||
FROM dblink_fetch('myconn','rmt_foobar_cursor',4,false) AS t(a int, b text, c text[]);
|
||||
NOTICE: cursor "rmt_foobar_cursor" does not exist
|
||||
CONTEXT: Error occurred on dblink connection named "myconn": could not fetch from cursor.
|
||||
CONTEXT: while fetching from cursor "rmt_foobar_cursor" on dblink connection named "myconn"
|
||||
a | b | c
|
||||
---+---+---
|
||||
(0 rows)
|
||||
@@ -589,7 +589,7 @@ SELECT dblink_exec('myconn','ABORT');
|
||||
SELECT *
|
||||
FROM dblink_fetch('myconn','rmt_foo_cursor',4) AS t(a int, b text, c text[]);
|
||||
ERROR: cursor "rmt_foo_cursor" does not exist
|
||||
CONTEXT: Error occurred on dblink connection named "myconn": could not fetch from cursor.
|
||||
CONTEXT: while fetching from cursor "rmt_foo_cursor" on dblink connection named "myconn"
|
||||
-- close the named persistent connection
|
||||
SELECT dblink_disconnect('myconn');
|
||||
dblink_disconnect
|
||||
|
Reference in New Issue
Block a user