<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pg_get_userbyid on Postgres Scripts</title><link>https://www.postgresscripts.com/tags/pg_get_userbyid/</link><description>Recent content in Pg_get_userbyid on Postgres Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>PostgresScripts.com</copyright><lastBuildDate>Fri, 03 Jul 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.postgresscripts.com/tags/pg_get_userbyid/index.xml" rel="self" type="application/rss+xml"/><item><title>Query PostgreSQL Tablespace Info with pg_tablespace</title><link>https://www.postgresscripts.com/post/query-postgresql-tablespace-info-pg-tablespace/</link><pubDate>Fri, 03 Jul 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/query-postgresql-tablespace-info-pg-tablespace/</guid><description>
&lt;h2 id="query-postgresql-tablespace-info-with-pg_tablespace"&gt;Query PostgreSQL Tablespace Info with pg_tablespace&lt;/h2&gt;
&lt;p&gt;What tablespaces exist in this cluster, who owns each one, and where do their files actually live on disk? &lt;code&gt;pg_tablespace&lt;/code&gt; answers all three: it holds one row per tablespace with the owner OID, access control list, storage options, and — via &lt;code&gt;pg_tablespace_location()&lt;/code&gt; — the on-disk path, all readable from a single catalog query without parsing configuration files or tracing symlinks by hand.&lt;/p&gt;
&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1012089347386563"
crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-1012089347386563"
data-ad-slot="7945792173"
data-ad-format="auto"
data-full-width-responsive="true"&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;h2 id="purpose-and-overview"&gt;Purpose and Overview&lt;/h2&gt;
&lt;p&gt;Tablespaces are PostgreSQL's mechanism for controlling where data files land on disk. Every cluster starts with two built-in spaces: &lt;code&gt;pg_default&lt;/code&gt;, which holds user tables and indexes, and &lt;code&gt;pg_global&lt;/code&gt;, which holds the cluster-wide system catalogs. Additional tablespaces appear when a DBA runs &lt;code&gt;CREATE TABLESPACE&lt;/code&gt; pointing at a different mount point — typically a faster SSD volume for a hot OLTP schema, a slower spinning disk for archive data, or a dedicated volume to isolate write-amplification from MVCC-heavy tables.&lt;/p&gt;</description></item><item><title>List PostgreSQL Collations with pg_collation and ICU</title><link>https://www.postgresscripts.com/post/list-collations-in-postgresql/</link><pubDate>Sun, 19 Apr 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/list-collations-in-postgresql/</guid><description>
&lt;h2 id="list-collations-available-in-postgresql"&gt;List Collations Available in PostgreSQL&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;pg_collation&lt;/code&gt; is the system catalog that holds every collation a database can use — the sort-and-compare rules behind &lt;code&gt;ORDER BY&lt;/code&gt;, &lt;code&gt;DISTINCT&lt;/code&gt;, comparison operators and text indexes. One query against it shows each collation's name, the library that implements it, and the locale it maps to, which is the first thing to check when text sorts differently on two servers.&lt;/p&gt;
&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1012089347386563"
crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-1012089347386563"
data-ad-slot="7945792173"
data-ad-format="auto"
data-full-width-responsive="true"&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;h2 id="purpose-and-overview"&gt;Purpose and Overview&lt;/h2&gt;
&lt;p&gt;A collation decides how text is ordered and compared. In PostgreSQL the &lt;a href="https://www.postgresql.org/docs/current/collation.html"&gt;collation feature&lt;/a&gt; &amp;quot;allows specifying the sort order and character classification behavior of data per-column, or even per-operation,&amp;quot; so one database can hold columns that sort by different rules.&lt;/p&gt;</description></item><item><title>List All Schemas in Your PostgreSQL Database</title><link>https://www.postgresscripts.com/post/list-schemas-in-postgresql/</link><pubDate>Mon, 13 Apr 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/list-schemas-in-postgresql/</guid><description>
&lt;h2 id="how-to-list-all-schemas-in-a-postgresql-database"&gt;How to List All Schemas in a PostgreSQL Database&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;information_schema.schemata&lt;/code&gt; is the SQL-standard view for listing schemas, and it returns one row per schema in the current database that the connected role owns or holds a privilege on. Behind it sits &lt;code&gt;pg_namespace&lt;/code&gt;, the system catalog that stores every schema with its owner and access list. The two answer slightly different questions, and picking the wrong one is how a schema audit misses the schemas the connected role cannot access.&lt;/p&gt;</description></item><item><title>List PostgreSQL Partitioned Tables with SQL</title><link>https://www.postgresscripts.com/post/list-postgresql-partitioned-tables/</link><pubDate>Thu, 09 Apr 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/list-postgresql-partitioned-tables/</guid><description>
&lt;h2 id="list-partitioned-and-ordinary-tables-in-postgresql"&gt;List Partitioned and Ordinary Tables in PostgreSQL&lt;/h2&gt;
&lt;p&gt;Before you change a retention job, plan a migration, or add a partition for next month, you need a plain list of which tables are partitioned and which are not. &lt;code&gt;pg_class&lt;/code&gt; joined to &lt;code&gt;pg_namespace&lt;/code&gt; gives that list for the whole database in one query, and a count from &lt;code&gt;pg_inherits&lt;/code&gt; shows how many partitions sit under each parent.&lt;/p&gt;
&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1012089347386563"
crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-1012089347386563"
data-ad-slot="7945792173"
data-ad-format="auto"
data-full-width-responsive="true"&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;h2 id="purpose-and-overview"&gt;Purpose and Overview&lt;/h2&gt;
&lt;p&gt;Declarative partitioning splits one logical table into many physical pieces. The parent — the partitioned table — holds no rows itself; the PostgreSQL documentation calls it a &amp;quot;virtual&amp;quot; table with no storage of its own. The rows live in its partitions, which are ordinary tables tied to the parent by their partition bounds. On a mature database it is easy to lose track of which large tables were partitioned, which were not, and which partitioning work was never finished.&lt;/p&gt;</description></item><item><title>GRANT SELECT on All Tables in PostgreSQL — with Examples</title><link>https://www.postgresscripts.com/post/grant-select-on-all-tables-in-postgresql/</link><pubDate>Fri, 27 Mar 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/grant-select-on-all-tables-in-postgresql/</guid><description>
&lt;h2 id="grant-select-on-all-tables-in-postgresql"&gt;Grant SELECT on All Tables in PostgreSQL&lt;/h2&gt;
&lt;p&gt;Third-party ETL connectors, BI platforms, and audit users all need read access to PostgreSQL tables — without write permissions that could corrupt production data. Granting SELECT table by table works until someone adds a new table and the connector silently skips it; &lt;code&gt;ALTER DEFAULT PRIVILEGES&lt;/code&gt; is the statement that closes that gap, applying SELECT to every future table the moment it is created.&lt;/p&gt;</description></item><item><title>List PostgreSQL Databases by Size with Access Check</title><link>https://www.postgresscripts.com/post/list-and-organize-your-postgresql-databases-by-size-with-access-check/</link><pubDate>Mon, 01 Apr 2024 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/list-and-organize-your-postgresql-databases-by-size-with-access-check/</guid><description>
&lt;h2 id="list-your-postgresql-databases-by-size-with-access-check"&gt;List Your PostgreSQL Databases by Size (With Access Check)&lt;/h2&gt;
&lt;p&gt;Keeping your PostgreSQL database server organized is crucial for optimal performance and manageability. A critical aspect of this organization is understanding the storage footprint of each database. This SQL code snippet empowers you to efficiently retrieve a list of all your PostgreSQL databases, sorted by their size in descending order, while also indicating whether you have access to connect to each database.&lt;/p&gt;</description></item></channel></rss>