pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Replace anonymized data in string
4+ messages / 3 participants
[nested] [flat]

* Replace anonymized data in string
@ 2021-11-12 14:12 Patrick FICHE <Patrick.Fiche@aqsacom.com>
  2021-11-12 14:15 ` Re: Replace anonymized data in string Daniel Gustafsson <daniel@yesql.se>
  2021-11-12 15:07 ` Re: Replace anonymized data in string Rob Sargent <robjsargent@gmail.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Patrick FICHE @ 2021-11-12 14:12 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Hi Team,

I have some data that has been anonymized and I would like to generate some test data from this. In some way, I would like to deanonymize this data with random data.

For example, phone numbers have been anonymized with changing the 5 right digits with the 8 digit (preserving length).
Applying this, the number 390694802756 was changed to 3906948088888.

I would like to get random digits at the end of the phone number knowing that anonymized data can be a variable length.
So, I would like to change every sequence (at least 2) of 8 by random value of same length (I don't worry if phone number contains 88 in the middle and this sequence is changed to random data)...

I tried to do this with replace / regexp_replace functions but could not achieve what I wanted to do.
I don't want these digits to be changed with a single one (88888 by 111111 or 99999 but something like 42384)...
Ideally, the new string would be different if multiple sequences of 8 appear in a string and would be different from one record to the other when applied to a full table...

Is there any way to do this ?

Thanks,
Patrick

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

* Re: Replace anonymized data in string
  2021-11-12 14:12 Replace anonymized data in string Patrick FICHE <Patrick.Fiche@aqsacom.com>
@ 2021-11-12 14:15 ` Daniel Gustafsson <daniel@yesql.se>
  2021-11-12 15:21   ` RE: Replace anonymized data in string Patrick FICHE <Patrick.Fiche@aqsacom.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Daniel Gustafsson @ 2021-11-12 14:15 UTC (permalink / raw)
  To: Patrick FICHE <Patrick.Fiche@aqsacom.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

> On 12 Nov 2021, at 15:12, Patrick FICHE <Patrick.Fiche@aqsacom.com> wrote:

> Is there any way to do this ?

There was a presentation on the subject of anonymization and data masking at
Fosdem PGDay 2019, maybe the slides from there can give any insights?

https://www.postgresql.eu/events/fosdem2019/schedule/session/2287-anonymization-and-data-masking-wit...

--
Daniel Gustafsson		https://vmware.com/






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

* RE: Replace anonymized data in string
  2021-11-12 14:12 Replace anonymized data in string Patrick FICHE <Patrick.Fiche@aqsacom.com>
  2021-11-12 14:15 ` Re: Replace anonymized data in string Daniel Gustafsson <daniel@yesql.se>
@ 2021-11-12 15:21   ` Patrick FICHE <Patrick.Fiche@aqsacom.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Patrick FICHE @ 2021-11-12 15:21 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

> On 12 Nov 2021, at 15:12, Patrick FICHE <Patrick.Fiche@aqsacom.com> wrote:

> Is there any way to do this ?

There was a presentation on the subject of anonymization and data masking at Fosdem PGDay 2019, maybe the slides from there can give any insights?

https://www.postgresql.eu/events/fosdem2019/schedule/session/2287-anonymization-and-data-masking-wit...

--

Thanks a lot for your answer.
This is a very good presentation for anonymization technics.
Unfortunately, my data has been already anonymized and I'm trying to random the anonymized part... which is a bit different from what I could find here 😊


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

* Re: Replace anonymized data in string
  2021-11-12 14:12 Replace anonymized data in string Patrick FICHE <Patrick.Fiche@aqsacom.com>
@ 2021-11-12 15:07 ` Rob Sargent <robjsargent@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Rob Sargent @ 2021-11-12 15:07 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 11/12/21 7:12 AM, Patrick FICHE wrote:
>
> Hi Team,
>
> I have some data that has been anonymized and I would like to generate 
> some test data from this. In some way, I would like to deanonymize 
> this data with random data.
>
> For example, phone numbers have been anonymized with changing the 5 
> right digits with the 8 digit (preserving length).
>
> Applying this, the number 390694802756 was changed to 3906948088888.
>
> I would like to get random digits at the end of the phone number 
> knowing that anonymized data can be a variable length.
>
> So, I would like to change every sequence (at least 2) of 8 by random 
> value of same length (I don’t worry if phone number contains 88 in the 
> middle and this sequence is changed to random data)…
>
> I tried to do this with replace / regexp_replace functions but could 
> not achieve what I wanted to do.
>
> I don’t want these digits to be changed with a single one (88888 by 
> 111111 or 99999 but something like 42384)…
>
> Ideally, the new string would be different if multiple sequences of 8 
> appear in a string and would be different from one record to the other 
> when applied to a full table…
>
> Is there any way to do this ?
>
> Thanks,
>
> Patrick
>
Usual trick it to select floor(random()*100000);

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


end of thread, other threads:[~2021-11-12 15:21 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 14:12 Replace anonymized data in string Patrick FICHE <Patrick.Fiche@aqsacom.com>
2021-11-12 14:15 ` Daniel Gustafsson <daniel@yesql.se>
2021-11-12 15:21   ` Patrick FICHE <Patrick.Fiche@aqsacom.com>
2021-11-12 15:07 ` Rob Sargent <robjsargent@gmail.com>

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