|
8 | 8 | * Darko Prenosil <Darko.Prenosil@finteh.hr>
|
9 | 9 | * Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
|
10 | 10 | *
|
11 |
| - * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.64 2007/07/08 17:12:38 joe Exp $ |
| 11 | + * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.65 2007/08/27 01:24:50 tgl Exp $ |
12 | 12 | * Copyright (c) 2001-2007, PostgreSQL Global Development Group
|
13 | 13 | * ALL RIGHTS RESERVED;
|
14 | 14 | *
|
|
51 | 51 | #include"nodes/pg_list.h"
|
52 | 52 | #include"parser/parse_type.h"
|
53 | 53 | #include"tcop/tcopprot.h"
|
| 54 | +#include"utils/acl.h" |
54 | 55 | #include"utils/array.h"
|
55 | 56 | #include"utils/builtins.h"
|
56 | 57 | #include"utils/dynahash.h"
|
@@ -1686,9 +1687,17 @@ get_pkey_attnames(Oid relid, int16 *numatts)
|
1686 | 1687 | char**result=NULL;
|
1687 | 1688 | Relationrel;
|
1688 | 1689 | TupleDesctupdesc;
|
| 1690 | +AclResultaclresult; |
1689 | 1691 |
|
1690 |
| -/* open relation using relid, get tupdesc */ |
| 1692 | +/* open relation using relid,check permissions,get tupdesc */ |
1691 | 1693 | rel=relation_open(relid,AccessShareLock);
|
| 1694 | + |
| 1695 | +aclresult=pg_class_aclcheck(RelationGetRelid(rel),GetUserId(), |
| 1696 | +ACL_SELECT); |
| 1697 | +if (aclresult!=ACLCHECK_OK) |
| 1698 | +aclcheck_error(aclresult,ACL_KIND_CLASS, |
| 1699 | +RelationGetRelationName(rel)); |
| 1700 | + |
1692 | 1701 | tupdesc=rel->rd_att;
|
1693 | 1702 |
|
1694 | 1703 | /* initialize numatts to 0 in case no primary key exists */
|
|