0
to try to do this query to "shuffle" the table data. This same query worked in mysql, but not in postgresql.
always get this error [Code: 0, SQL State: 42712] ERROR: table name "mytableteste" specified more than Once
UPDATE mytableteste set
desc_nome = desc_nome.newValue,
numr_cpf = numr_cpf.newValue,
data_nascimento = data_nascimento.newValue,
desc_mae = desc_mae.newValue from mytableteste
INNER JOIN (
SELECT ROW_NUMBER() OVER (ORDER BY numg_iddoobjeto) AS rn, numg_iddoobjeto from mytableteste
) AS PKrows ON mytableteste.numg_iddoobjeto = PKrows.numg_iddoobjeto
-- repeat the following JOIN for each column you want to randomize
INNER JOIN (
SELECT ROW_NUMBER() OVER (ORDER BY random()) AS rn, desc_nome AS newValue from mytableteste
) AS desc_nome ON PKrows.rn = desc_nome.rn
INNER JOIN (
SELECT ROW_NUMBER() OVER (ORDER BY random()) AS rn, numr_cpf AS newValue from mytableteste
) AS numr_cpf ON PKrows.rn = numr_cpf.rn
INNER JOIN (
SELECT ROW_NUMBER() OVER (ORDER BY random()) AS rn, data_nascimento AS newValue from mytableteste
) AS data_nascimento ON PKrows.rn = data_nascimento.rn
INNER JOIN (
SELECT ROW_NUMBER() OVER (ORDER BY random()) AS rn, desc_mae AS newValue from mytableteste
) AS desc_mae ON PKrows.rn = desc_mae.rn