public inbox for [email protected]  
help / color / mirror / Atom feed
GENERATED ALWAYS AS - Not Consistent with MD5
2+ messages / 2 participants
[nested] [flat]

* GENERATED ALWAYS AS - Not Consistent with MD5
@ 2022-03-21 22:42 PG Doc comments form <[email protected]>
  2022-03-25 01:48 ` Re: GENERATED ALWAYS AS - Not Consistent with MD5 Euler Taveira <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Doc comments form @ 2022-03-21 22:42 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

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.


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: GENERATED ALWAYS AS - Not Consistent with MD5
  2022-03-21 22:42 GENERATED ALWAYS AS - Not Consistent with MD5 PG Doc comments form <[email protected]>
@ 2022-03-25 01:48 ` Euler Taveira <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Euler Taveira @ 2022-03-25 01:48 UTC (permalink / raw)
  To: [email protected]; [email protected]

On Mon, Mar 21, 2022, at 7:42 PM, PG Doc comments form wrote:
> 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.
> 
It works for me. Could you provide a self-contained test case? What's your
current version?

This list is for documentation discussion. For general questions, use
pgsql-general. For bug reports, use pgsql-bugs.


--
Euler Taveira
EDB   https://www.enterprisedb.com/


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-03-25 01:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 22:42 GENERATED ALWAYS AS - Not Consistent with MD5 PG Doc comments form <[email protected]>
2022-03-25 01:48 ` Euler Taveira <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox