GENERATED ALWAYS AS - Not Consistent with MD5

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: ranasalal(at)gmail(dot)com
Subject: GENERATED ALWAYS AS - Not Consistent with MD5
Date: 2022-03-21 22:42:40
Message-ID: 164790256029.701350.8616885741554177403@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/ddl-generated-columns.html
Description:

In my table definition - my Id Column is defined as ```Id TEXT PRIMARY KEY
GENERATED ALWAYS AS (MD5(date_part('epoch', Inv_Date)::TEXT || TerminalId ||
GradeId || Ownership_Code)) STORED,```

But the value generated is not consistent upon insertion.
To confirm we checked by generating MD5 on SELECT and comparing the Id,
they're two completely different values.

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Peter Eisentraut 2022-03-23 13:04:47 Re: maximum number of backtrace frames logged by backtrace_functions
Previous Message Julien Rouhaud 2022-03-21 12:12:10 Re: SQL "RETURNING * | output_expression [ [ AS ]" is wrong