8.1 removed functions

Started by Андрейover 20 years ago4 messagesgeneral
Jump to latest
#1Андрей
andyk@softwarium.net

Hello!

Can someone answer - why in PostgreSQL 8.1 have been removed such
functions as 'makeaclitem(...)' and
'information_schema.pg_keypositions()'. Are there any similar functions
now and where can I find the list of all deprecated functions?

Best
Regards,

Kovalevski Andrei,

soft@andrei.in.ua

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Андрей (#1)
Re: 8.1 removed functions

=?UTF-8?B?0JDQvdC00YDQtdC5?= <andyk@softwarium.net> writes:

Can someone answer - why in PostgreSQL 8.1 have been removed such
functions as 'makeaclitem(...)' and
'information_schema.pg_keypositions()'.

Because code using them would be broken anyway by other changes in 8.1
--- for example, using pg_keypositions to iterate over function
arguments would now be wrong because there isn't a fixed upper limit on
number of arguments.

If you were using them, you'll need to tell us what for in order to get
advice about what to do instead.

regards, tom lane

#3Noname
nielsgron@gmail.com
In reply to: Андрей (#1)
Re: 8.1 removed functions

Hi Tom,

With PG 8.0 I was using a query using makeaclitem() and aclcontains()
to extract permissions. Here is a sample query for database
permissions ...

SELECT
((grantee.name)::character varying) AS grantee,
((nc.datname)::character varying) AS database,
(pr."type") AS privilege_type,
(
CASE
WHEN aclcontains(nc.datacl, makeaclitem(grantee.usesysid,
grantee.grosysid, u_grantor.usesysid, pr."type", true))
THEN 'YES'::text
ELSE 'NO'::text
END) AS is_grantable,
('NO') AS with_hierarchy
FROM
pg_database nc,
pg_user u_grantor,
((((( SELECT pg_user.usesysid, 0, pg_user.usename FROM pg_user )
UNION ALL
( SELECT 0, pg_group.grosysid, pg_group.groname FROM pg_group
)
)) UNION ALL ( SELECT 0, 0, 'PUBLIC' ) )) grantee(usesysid, grosysid,
name),
((((( SELECT 'CREATE' ) UNION ALL ( SELECT 'TEMP' ) )) UNION ALL (
SELECT 'USAGE' ) )) pr("type")
WHERE
aclcontains(nc.datacl, makeaclitem(grantee.usesysid, grantee.grosysid,
u_grantor.usesysid, pr."type", false))
AND (grantee.name = 'postgres'::name)

What is the recommended manner to extract object permissions for 8.1
now that these functions are not available?

regards,
-Niels

#4Michael Fuhr
mike@fuhr.org
In reply to: Noname (#3)
Re: 8.1 removed functions

On Wed, Dec 28, 2005 at 05:34:47PM -0800, nielsgron@gmail.com wrote:

With PG 8.0 I was using a query using makeaclitem() and aclcontains()
to extract permissions. Here is a sample query for database
permissions ...

[...]

What is the recommended manner to extract object permissions for 8.1
now that these functions are not available?

aclcontains is still there but makeaclitem's signature has changed:

8.0.5
test=> \df makeaclitem|aclcontains
List of functions
Schema | Name | Result data type | Argument data types
------------+-------------+------------------+------------------------------------------
pg_catalog | aclcontains | boolean | aclitem[], aclitem
pg_catalog | makeaclitem | aclitem | integer, integer, integer, text, boolean
(2 rows)

8.1.1
test=> \df makeaclitem|aclcontains
List of functions
Schema | Name | Result data type | Argument data types
------------+-------------+------------------+-------------------------
pg_catalog | aclcontains | boolean | aclitem[], aclitem
pg_catalog | makeaclitem | aclitem | oid, oid, text, boolean
(2 rows)

For examples look at standard views that use makeaclitem:

SELECT * FROM pg_views WHERE definition ~* 'makeaclitem';

--
Michael Fuhr