Skip to content

Commit b05d3ae

Browse files
committed
Error message editing in backend/libpq, backend/postmaster, backend/tcop.
Along the way, fix some logic problems in pgstat_initstats, notably the bogus assumption that malloc returns zeroed memory.
1 parent 277dbb0 commit b05d3ae

File tree

21 files changed

+1249
-810
lines changed

21 files changed

+1249
-810
lines changed

doc/src/sgml/sources.sgml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/sources.sgml,v 2.9 2003/07/18 23:20:32 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/sources.sgml,v 2.10 2003/07/22 19:00:07 tgl Exp $
33
-->
44

55
<chapter id="source">
@@ -234,6 +234,13 @@ less -x4
234234
primary error message text.
235235
</para>
236236
</listitem>
237+
<listitem>
238+
<para>
239+
<function>errcode_for_socket_access</>() is a convenience function that
240+
selects an appropriate SQLSTATE error identifier for a failure in a
241+
socket-related system call.
242+
</para>
243+
</listitem>
237244
</itemizedlist>
238245
</para>
239246

src/backend/commands/alter.c

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/alter.c,v 1.2 2003/07/20 21:56:32 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/alter.c,v 1.3 2003/07/22 19:00:07 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -29,41 +29,12 @@
2929
#include "commands/user.h"
3030
#include "miscadmin.h"
3131
#include "parser/parse_clause.h"
32+
#include "tcop/utility.h"
3233
#include "utils/acl.h"
3334
#include "utils/lsyscache.h"
3435
#include "utils/syscache.h"
3536

3637

37-
static void
38-
CheckOwnership(RangeVar *rel, bool noCatalogs)
39-
{
40-
Oid relOid;
41-
HeapTuple tuple;
42-
43-
relOid = RangeVarGetRelid(rel, false);
44-
tuple = SearchSysCache(RELOID,
45-
ObjectIdGetDatum(relOid),
46-
0, 0, 0);
47-
if (!HeapTupleIsValid(tuple)) /* should not happen */
48-
elog(ERROR, "cache lookup failed for relation %u", relOid);
49-
50-
if (!pg_class_ownercheck(relOid, GetUserId()))
51-
aclcheck_error(ACLCHECK_NOT_OWNER, rel->relname);
52-
53-
if (noCatalogs)
54-
{
55-
if (!allowSystemTableMods &&
56-
IsSystemClass((Form_pg_class) GETSTRUCT(tuple)))
57-
ereport(ERROR,
58-
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
59-
errmsg("relation \"%s\" is a system catalog",
60-
rel->relname)));
61-
}
62-
63-
ReleaseSysCache(tuple);
64-
}
65-
66-
6738
void
6839
ExecRenameStmt(RenameStmt *stmt)
6940
{
@@ -111,7 +82,7 @@ ExecRenameStmt(RenameStmt *stmt)
11182
{
11283
Oid relid;
11384

114-
CheckOwnership(stmt->relation, true);
85+
CheckRelationOwnership(stmt->relation, true);
11586

11687
relid = RangeVarGetRelid(stmt->relation, false);
11788

src/backend/commands/copy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.203 2003/07/21 17:04:58 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.204 2003/07/22 19:00:07 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1923,7 +1923,7 @@ CopyReadBinaryAttribute(int column_no, FmgrInfo *flinfo, Oid typelem,
19231923
/* Trouble if it didn't eat the whole buffer */
19241924
if (attribute_buf.cursor != attribute_buf.len)
19251925
ereport(ERROR,
1926-
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
1926+
(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
19271927
errmsg("incorrect binary data format in field %d",
19281928
column_no)));
19291929

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy