Unofficial Hacker News companion — get notified on comment replies, and more.

What Changes When You Upgrade from PostgreSQL 18 to 19 (opens external site)

137 points by rgoomar 6 days ago | rishigoomar.com | 76 comments on HN | Vote on HN (opens Hacker News) |

View full thread · View on Hacker News

Comment thread (8)

  1. > Try storing datetimeoffset

    Datetime+offset is virtually never useful to store. Almost always a mistake or at best unnecessary.

    You can use a composite type if you really want to, but it’s such a niche case I’m not surprised there’s not a dedicated feature.

    > case-insensitive search over it (prefix and equal).

    Has worked for decades, since 2003.

      CREATE INDEX ON person (lower(last_name) text_patten_ops);
    
      SELECT *
      FROM person
      WHERE lower(last_name) LIKE ‘smi%’;
    Replies (1)
    1. > as worked for decades, since 2003.

      My man, suppose you use an ORM. With your approach you must not forget to:

      1. Lower the column

      2. Lower the search term

      … every single time you write a query.

      And god forbid you fuck this up even once. This is not how reliable systems are done

      Replies (3)
      1. I’m fairly positive you could teach the ORM to do that fairly easily in most ORMs. I’d be much more concerned by the non-ORM case.

        But also isn’t the correct answer to set your collation if you actually need it across the board

        Replies (1)
        1. That type of collations were added around 12 months ago.

          Before that I guess pg people liked to eat cactus. Or I dunno store everything in CAPS :-)

          Replies (1)
          1. you’d have been using citext
      2. There is a whole feature of postgres and SQL standards called "collations" that I think you may be ignoring here..?

        A collation can specialize how comparison and ordering work. In postgres this would also affect the pattern matching operators. I think there have been improvements here over the recent versions, where a "non-deterministic" collation (of which case-insensitivity is an example) is supported by pattern matchers when it wouldn't in older versions.

        You can define a column with a custom collation to override the default for the column type. You can also define a domain type with a custom collation, and use that domain for column definitions, so you don't need to set the collation explicitly in every column definition. E.g. you could define a "citext" domain over "text" that adds the case-insensitivity but otherwise stores text.

        Replies (1)
        1. You forgot the part where we need prefix search (like first letters of a lastname).

          Now ask jeepeetee when LIKE support with nondeterministic collations was added to postgres

          It was 2025 year of our lord. That’s how user friendly pg is.

      3. > every single time you write a query

        Only when you want to do a case intensive comparison.

        Forgive me, but you see to be looking for an opportunity to complain about it.