Jekyll2024-03-13T15:08:47+01:00https://postgresql.verite.pro/blog/feed.xmlPostgreSQL Notes - Daniel VéritéA blog about working with PostgreSQL.
Daniel VéritéUsing binary-sorted indexes2024-03-13T11:49:00+01:002024-03-13T11:49:00+01:00https://postgresql.verite.pro/blog/2024/03/13/binary-sorted-indexesDaniel VéritéIn a previous post, I mentioned that Postgres databases often have text indexes sorted linguistically rather than bytewise, which is why they need to be reindexed on libc or ICU upgrades. In this post, let’s discuss how to use bytewise sorts, and what are the upsides and downsides of doing so.Global search inside a database2023-12-14T00:04:14+01:002023-12-14T00:04:14+01:00https://postgresql.verite.pro/blog/2023/12/14/global-searchDaniel VéritéLet's implement a search function that can look for something into all columns of all tables.The collation versioning problem with ICU 732023-10-20T16:15:02+02:002023-10-20T16:15:02+02:00https://postgresql.verite.pro/blog/2023/10/20/icu-73-versioningDaniel VéritéA versioning bug in the ICU 73 release might affect people that use ICU collations with Postgres. Let's explain the issue and see what to do about it.Using traditional calendars with ICU2023-09-27T20:14:20+02:002023-09-27T20:14:20+02:00https://postgresql.verite.pro/blog/2023/09/27/icu-traditional-calendarsDaniel VéritéHow to use alternative date and time types to use non-gregorian calendars with ICU.A psql hack for select * except some columns2022-02-21T19:00:00+01:002022-02-21T19:00:00+01:00https://postgresql.verite.pro/blog/2022/02/21/psql-hack-select-exceptDaniel VéritéA proof of concept on how to compose psql meta-commands and a custom front-end editor to inject column into the query buffer.Isolation Repeatable Read in PostgreSQL versus MySQL2020-02-14T19:14:12+01:002020-02-14T19:14:12+01:00https://postgresql.verite.pro/blog/2020/02/14/isolation-repeatable-read-postgresql-mysqlDaniel VéritéTo avoid having concurrent transactions interfere with each other, SQL engines implement isolation as a feature. This property corresponds to the I letter in the well known ACID acronym, the other properties being Atomicity, Consistency and Durability.Multiple strings replacement with plperl2020-01-27T12:05:02+01:002020-01-27T12:05:02+01:00https://postgresql.verite.pro/blog/2020/01/27/strings-multi-replace-plperlDaniel VéritéSubstituting a single string by another within a larger string is straightforward in SQL, with the replace function:Nondeterministic collations2019-10-14T00:00:00+02:002019-10-14T00:00:00+02:00https://postgresql.verite.pro/blog/2019/10/14/nondeterministic-collationsDaniel VéritéSince version 12, PostgreSQL collations are created with a parameter named deterministic, that can be true or false, so that collations are now either deterministic (which they are by default), or nondeterministic.The CSV output format in psql2019-07-06T14:50:12+02:002019-07-06T14:50:12+02:00https://postgresql.verite.pro/blog/2019/07/06/psql-csv-outputDaniel VéritéExporting query results in CSV has been possible for a long time (since version 8.0), either with COPY (SELECT ...) TO STDOUT CSV as an SQL command, or with the \copy meta-command in psql, which invokes COPY under the hood and handles the flow of data on the client side.OIDs demoted to normal columns: a glance at the past2019-04-24T14:17:04+02:002019-04-24T14:17:04+02:00https://postgresql.verite.pro/blog/2019/04/24/oid-columnDaniel VéritéIn PostgreSQL 12, oid columns in system tables will loose their “special” nature, and the optional clause WITH OIDS will disapppear from CREATE TABLE. As a concrete consequence, oid will now be visible when running select * from the catalogs that have OIDs, as well as when querying information_schema.columns, or with \d inside psql. Until now they were hidden, as are all system columns such as xmin or xmax.