I have an error in Postgresql when I try to execute a simple insert statement.
After much trial and error I have discovered that it is the single quote around the text that is causing the trouble. I am initialising the data in the table from a list in LibreOffice. In LibreOffice the single quote in the following statement looks like this:
INSERT INTO public.cluster
(name, description)
VALUES
(‘Mining‘, ‘Mines and sells the minerals‘);
I then copy the statement into pgadmin and executing the statement yields and error.
If I edit the statement in pgadmin by deleting the single quote and replacing it with a single quote (same button on the keyboard!) the single quote looks like this and the statement executes just fine:
INSERT INTO public.cluster
(name, description)
VALUES
('Media', 'Provides platforms for internet services');
My question is does anyone know why there is a different behaviour in which single quote is used by LibreOffice vs pgAdmin and how do I ensure the "correct" single quote is inserted by LibreOffice?
As others have mentioned, it is better to use a plain text editor.
However it can be done with LibreOffice by turning off smart quotes and replacing all existing quotes. Instructions are at http://earlruby.org/2011/08/how-to-turn-off-smart-quotes-in-libre-office-writer/.