Skip to main content

Showing tag results for Data Types

Posts

0 comments 0 reactions

How to Write a Date in PostgreSQL

Jagdish Kumawat

Write dates in PostgreSQL year first, as YYYY-MM-DD after the DATE key word, so every server reads them the same way.

  • Database
  • PostgreSQL
0 comments 0 reactions

How to Write a String in PostgreSQL

Jagdish Kumawat

Write text in PostgreSQL between single quotes, and type a single quote twice to put one inside the text.

  • Database
  • PostgreSQL
0 comments 0 reactions

smallint vs integer vs bigint in PostgreSQL

Jagdish Kumawat

PostgreSQL’s three whole-number types differ only in size and range. Each limit is tried live, with advice on which one to use.

  • Database
  • PostgreSQL
0 comments 0 reactions

How to Check a Column’s Data Type in PostgreSQL

Jagdish Kumawat

Check the data type of every column in a PostgreSQL table with a psql command, or with an information_schema query in any tool.

  • Database
  • PostgreSQL
0 comments 0 reactions

How to Generate a UUID in PostgreSQL

Jagdish Kumawat

Generate random and time-ordered UUIDs in PostgreSQL with gen_random_uuid() and uuidv7(), and use one as a table’s ID.

  • Database
  • PostgreSQL
0 comments 0 reactions

Identity vs Serial in PostgreSQL: Which to Use for IDs

Jagdish Kumawat

Identity columns and serial both give rows numbers that count up by themselves. Here’s why an identity column is the better choice for IDs, tried side by side.

  • Database
  • PostgreSQL
0 comments 0 reactions

timestamp vs timestamptz in PostgreSQL

Jagdish Kumawat

timestamptz stores a moment and shows it in your time zone; timestamp keeps only the clock reading. One table, viewed from two time zones, shows the difference.

  • Database
  • PostgreSQL
0 comments 0 reactions

How to Store Money in PostgreSQL: numeric vs money

Jagdish Kumawat

Store prices in PostgreSQL with numeric and two decimals, and see why the money and real types are worse choices, with real psql output.

  • Database
  • PostgreSQL