Import txt to postgresql

Asked

Viewed 161 times

0

I created the following txt file:

'Granada', current_timestamp
'Grecia', current_timestamp
'Guatemala', current_timestamp
'Guiana', current_timestamp
'Guine', current_timestamp
'Guine Esquatorial', current_timestamp
'Guine Bissau', current_timestamp
'Haiti', current_timestamp
'Honduras', current_timestamp
'Hungria', current_timestamp
'Lemen', current_timestamp
'Ilhas Marechal', current_timestamp
'India', current_timestamp
'Indonesia', current_timestamp
'Irao', current_timestamp
'Iraque', current_timestamp
'Irlanda', current_timestamp
'Islandia', current_timestamp
'Israel', current_timestamp
'Italia', current_timestamp
'Jamaica', current_timestamp
'Japao', current_timestamp
'Jibuti', current_timestamp
'Jordania', current_timestamp
'Laus', current_timestamp
'Lesoto', current_timestamp
'Letonia', current_timestamp
'Libano', current_timestamp
'Liberia', current_timestamp
'Libia', current_timestamp
'Listenstaine', current_timestamp
'Lituania', current_timestamp

To update the parent table, use the following command in pgAdmin4:

COPY pais (pais, ultima_atualizacao)
FROM 'C:\Users\magno\Documents\arquivo_paises.txt'
DELIMITER ',';

But this command results in the following error:

ERROR:  date/time value "current" is no longer supported
CONTEXT:  COPY pais, line 1, column ultima_atualizacao: " current_timestamp"
********** Error **********

ERROR: date/time value "current" is no longer supported
SQL state: 0A000
Context: COPY pais, line 1, column ultima_atualizacao: " current_timestamp"
  • Here we do not add SOLVED in the title, only the acceptance of the answer is sufficient ;)

1 answer

0


Replace the word current_timestamp in your text file with now():

'Granada', now()
'Grecia', now()
'Guatemala', now()
'Guiana', now()
'Guine', now()
'Guine Esquatorial', now()
'Guine Bissau', now()
'Haiti', now()
'Honduras', now()
'Hungria', now()
'Lemen', now()
'Ilhas Marechal', now()
'India', now()
'Indonesia', now()
'Irao', now()
'Iraque', now()
'Irlanda', now()
'Islandia', now()
'Israel', now()
'Italia', now()
'Jamaica', now()
'Japao', now()
'Jibuti', now()
'Jordania', now()
'Laus', now()
'Lesoto', now()
'Letonia', now()
'Libano', now()
'Liberia', now()
'Libia', now()
'Listenstaine', now()
'Lituania', now()

Browser other questions tagged

You are not signed in. Login or sign up in order to post.