Urgent.News

What's breaking now, across thousands of outlets.

Tech

Postgres timestamp vs timestamptz 2026: Rule and Migration

Use timestamptz for every column that records a moment in time, store it as UTC, and convert to a local zone only when you display it. Both types take 8 bytes and have 1 microsecond resolution[1], so the choice costs nothing in space. What differs is meaning: timestamptz stores an instant, while timestamp stores a wall-clock reading with no zone attached, and Postgres will silently drop any…

PostgreSQL offers two timestamp types: timestamp and timestamptz. The key difference lies in how they handle time zones. timestamptz stores an instant in UTC, while timestamp stores a wall-clock reading without any zone. Regardless of the input, both types are stored as UTC, and Postgres converts them to the session's local time zone when displaying.

Choosing the right timestamp type is crucial to avoid common bugs. The SQL standard refers to plain timestamp as "timestamp without time zone" because it lacks a time zone component. However, many developers mistakenly use it as the default due to its name.

Using timestamptz for every column that records a moment in time is recommended. Store it as UTC and convert to a local zone only when displaying. This approach eliminates the four classic bugs associated with timestamp columns: server TimeZone changes, DST gaps and overlaps, comparing now() against the wrong type, and applying AT TIME ZONE twice.

Prisma, Drizzle, and Rails default to the zone-less type, whereas Django's PostgreSQL backend uses the zone-aware type. The one exception is when dealing with a future local-time appointment, such as a 9:00 meeting in Kolkata on March 3rd. In this case, the local time should be kept along with an IANA zone name.

To migrate from zone-less timestamp columns to timestamptz, use an in-place type change if the session zone is UTC. For other cases, follow the add-column, backfill, and swap route. By adopting timestamptz and following the migration recipe, you can ensure accurate and reliable timestamp handling in your PostgreSQL database.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The Stateful Agent Memory Trap: Why Swarms Bleed Context

Originally published by **Asif Muhammad Iqbal (Founder & CEO at Logic42) * at https://logic42.ai/articles/stateful-agent-memory-trap-context-bloat .* The Stateful Agent Memory Trap: Why Swarms Bleed…

  • Stateful agent memory trap arises from appending tool outputs directly into conversation buffers
  • Multi-step workflows generate bloated context exceeding 80,000 tokens in enterprise settings
  • Bounded state graph architecture recommended to mitigate context bloat and associated costs

Firefox Developer Edition vs Regular Firefox: What's Actually Different

Firefox Developer Edition is a separate browser build targeted at developers. Here's what it actually offers differently, so you can decide whether it's worth running alongside regular Firefox.

  • Firefox Developer Edition is designed for developers, based on Firefox Beta channel.
  • It includes developer-specific defaults like CSS Grid Layout Inspector and Remote Debugging.
  • Separate profile and Storage Inspector are unique features for debugging.

Firefox Built-in Password Manager vs. Bitwarden: Which Should You Use?

Firefox has a built-in password manager (now called "passwords" in about:logins). It's actually quite capable. Here's an honest comparison with a dedicated tool like Bitwarden.

  • Firefox built-in password manager available in about:logins
  • Bitwarden offers cross-browser compatibility, iOS, Android apps
  • Consider needs: single browser use vs. multiple devices, team sharing

Why Does My Phone Security Camera Show Dark Rolling Bands Under Tube Lights? 50 Hz Power, Android's Anti-Banding Setting, and What Actually Fixes It

You point an old Android phone at the shop counter, start recording, and check the footage that evening. The picture is sharp and the colours are fine, but there are soft dark stripes across the…

  • Android's camera system has anti-banding setting (CONTROLAEANTIBANDINGMODE) to prevent bands.
  • Set phone to 50Hz or 60Hz antibanding mode according to local power frequency to fix issue.

More from Friday 16 October →