mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-22 00:13:22 +02:00
It was never terribly consistent to use OR REPLACE (because of the lack of comparable functionality for data types, operators, etc), and experimentation shows that it's now positively pernicious in the extension world. We really want a failure to occur if there are any conflicts, else it's unclear what the extension-ownership state of the conflicted object ought to be. Most of the time, CREATE EXTENSION will fail anyway because of conflicts on other object types, but an extension defining only functions can succeed, with bad results.
18 lines
610 B
SQL
18 lines
610 B
SQL
/* contrib/pg_buffercache/pg_buffercache--1.0.sql */
|
|
|
|
-- Register the function.
|
|
CREATE FUNCTION pg_buffercache_pages()
|
|
RETURNS SETOF RECORD
|
|
AS 'MODULE_PATHNAME', 'pg_buffercache_pages'
|
|
LANGUAGE C;
|
|
|
|
-- Create a view for convenient access.
|
|
CREATE VIEW pg_buffercache AS
|
|
SELECT P.* FROM pg_buffercache_pages() AS P
|
|
(bufferid integer, relfilenode oid, reltablespace oid, reldatabase oid,
|
|
relforknumber int2, relblocknumber int8, isdirty bool, usagecount int2);
|
|
|
|
-- Don't want these to be available to public.
|
|
REVOKE ALL ON FUNCTION pg_buffercache_pages() FROM PUBLIC;
|
|
REVOKE ALL ON pg_buffercache FROM PUBLIC;
|