Skip to content

Commit a9d3c2c

Browse files
committed
Revert patch --- needs more generalized solution.
> Please find a attached a small patch that adds accessor functions > for "aclitem" so that it is not an opaque datatype. > > I needed these functions to browse aclitems from user land. I can load > them when necessary, but it seems to me that these accessors for a > backend type belong to the backend, so I submit them. > > Fabien Coelho
1 parent 7ebd5da commit a9d3c2c

File tree

6 files changed

+5
-82
lines changed

6 files changed

+5
-82
lines changed

src/backend/utils/adt/acl.c

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.102 2004/04/26 15:06:48 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.103 2004/05/02 13:38:27 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -874,43 +874,6 @@ makeaclitem(PG_FUNCTION_ARGS)
874874
PG_RETURN_ACLITEM_P(aclitem);
875875
}
876876

877-
/* give access to internal data within aclitem
878-
*/
879-
Datum
880-
aclitem_grantee(PG_FUNCTION_ARGS)
881-
{
882-
AclItem * a = PG_GETARG_ACLITEM_P(0);
883-
PG_RETURN_INT32(a->ai_grantee);
884-
}
885-
886-
Datum
887-
aclitem_grantor(PG_FUNCTION_ARGS)
888-
{
889-
AclItem * a = PG_GETARG_ACLITEM_P(0);
890-
PG_RETURN_INT32(a->ai_grantor);
891-
}
892-
893-
Datum
894-
aclitem_idtype(PG_FUNCTION_ARGS)
895-
{
896-
AclItem * a = PG_GETARG_ACLITEM_P(0);
897-
PG_RETURN_INT32(ACLITEM_GET_IDTYPE(*a));
898-
}
899-
900-
Datum
901-
aclitem_privs(PG_FUNCTION_ARGS)
902-
{
903-
AclItem * a = PG_GETARG_ACLITEM_P(0);
904-
PG_RETURN_INT32(ACLITEM_GET_PRIVS(*a));
905-
}
906-
907-
Datum
908-
aclitem_goptions(PG_FUNCTION_ARGS)
909-
{
910-
AclItem * a = PG_GETARG_ACLITEM_P(0);
911-
PG_RETURN_INT32(ACLITEM_GET_GOPTIONS(*a));
912-
}
913-
914877
static AclMode
915878
convert_priv_string(text *priv_type_text)
916879
{

src/include/catalog/catversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
40-
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.225 2004/04/26 15:06:49 momjian Exp $
40+
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.226 2004/05/02 13:38:27 momjian Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 200404260
56+
#define CATALOG_VERSION_NO 200404220
5757

5858
#endif

src/include/catalog/pg_proc.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.326 2004/04/26 15:06:49 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.327 2004/05/02 13:38:27 momjian Exp $
1111
*
1212
* NOTES
1313
* The script catalog/genbki.sh reads this file and generates .bki
@@ -3534,18 +3534,6 @@ DESCR("non-persistent series generator");
35343534
DATA(insert OID = 1069 ( generate_series PGNSP PGUID 12 f f t t v 2 20 "20 20" _null_ generate_series_int8 - _null_ ));
35353535
DESCR("non-persistent series generator");
35363536

3537-
/* aclitem utils */
3538-
DATA(insert OID = 2510 ( aclitem_grantor PGNSP PGUID 12 f f t f i 1 23 "1033" _null_ aclitem_grantor - _null_ ));
3539-
DESCR("extract user id grantor from aclitem");
3540-
DATA(insert OID = 2511 ( aclitem_grantee PGNSP PGUID 12 f f t f i 1 23 "1033" _null_ aclitem_grantee - _null_ ));
3541-
DESCR("extract grantee (user or group id) from aclitem");
3542-
DATA(insert OID = 2512 ( aclitem_idtype PGNSP PGUID 12 f f t f i 1 23 "1033" _null_ aclitem_idtype - _null_ ));
3543-
DESCR("extract id type of grantee (0 public, 1 user, 2 group) from aclitem");
3544-
DATA(insert OID = 2513 ( aclitem_privs PGNSP PGUID 12 f f t f i 1 23 "1033" _null_ aclitem_privs - _null_ ));
3545-
DESCR("extract privileges from aclitem");
3546-
DATA(insert OID = 2514 ( aclitem_goptions PGNSP PGUID 12 f f t f i 1 23 "1033" _null_ aclitem_goptions - _null_ ));
3547-
DESCR("extract grant options from aclitem");
3548-
35493537

35503538
/*
35513539
* Symbolic values for provolatile column: these indicate whether the result

src/include/utils/acl.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/utils/acl.h,v 1.67 2004/04/26 15:06:49 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/utils/acl.h,v 1.68 2004/05/02 13:38:28 momjian Exp $
1111
*
1212
* NOTES
1313
* An ACL array is simply an array of AclItems, representing the union
@@ -220,11 +220,6 @@ extern Datum aclcontains(PG_FUNCTION_ARGS);
220220
extern Datum makeaclitem(PG_FUNCTION_ARGS);
221221
extern Datum aclitem_eq(PG_FUNCTION_ARGS);
222222
extern Datum hash_aclitem(PG_FUNCTION_ARGS);
223-
extern Datum aclitem_grantee(PG_FUNCTION_ARGS);
224-
extern Datum aclitem_grantor(PG_FUNCTION_ARGS);
225-
extern Datum aclitem_idtype(PG_FUNCTION_ARGS);
226-
extern Datum aclitem_privs(PG_FUNCTION_ARGS);
227-
extern Datum aclitem_goptions(PG_FUNCTION_ARGS);
228223

229224
/*
230225
* prototypes for functions in aclchk.c

src/test/regress/expected/privileges.out

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -581,20 +581,6 @@ SELECT has_table_privilege('regressuser1', 'atest4', 'SELECT WITH GRANT OPTION')
581581
t
582582
(1 row)
583583

584-
-- aclitem utils small test
585-
SELECT u1.usename AS u1, u2.usename AS u2,
586-
aclitem_idtype(c.relacl[0]) AS idtype,
587-
aclitem_privs(c.relacl[0]) AS privs,
588-
aclitem_goptions(c.relacl[0]) AS goptions
589-
FROM pg_class AS c, pg_user AS u1, pg_user AS u2
590-
WHERE u1.usesysid = aclitem_grantor(c.relacl[0])
591-
AND u2.usesysid = aclitem_grantee(c.relacl[0])
592-
AND c.relname LIKE 'atest4';
593-
u1 | u2 | idtype | privs | goptions
594-
--------------+--------------+--------+-------+----------
595-
regressuser1 | regressuser1 | 1 | 127 | 127
596-
(1 row)
597-
598584
-- clean up
599585
\c regression
600586
DROP FUNCTION testfunc2(int);

src/test/regress/sql/privileges.sql

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,6 @@ SELECT has_table_privilege('regressuser3', 'atest4', 'SELECT'); -- false
316316

317317
SELECT has_table_privilege('regressuser1', 'atest4', 'SELECT WITH GRANT OPTION'); -- true
318318

319-
-- aclitem utils small test
320-
SELECT u1.usename AS u1, u2.usename AS u2,
321-
aclitem_idtype(c.relacl[0]) AS idtype,
322-
aclitem_privs(c.relacl[0]) AS privs,
323-
aclitem_goptions(c.relacl[0]) AS goptions
324-
FROM pg_class AS c, pg_user AS u1, pg_user AS u2
325-
WHERE u1.usesysid = aclitem_grantor(c.relacl[0])
326-
AND u2.usesysid = aclitem_grantee(c.relacl[0])
327-
AND c.relname LIKE 'atest4';
328319

329320
-- clean up
330321

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