Azure Database for PostgreSQL
An Azure managed PostgreSQL database service for app development and deployment.
1,070 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
On freshly new Azure Database for PostgreSQL flexible server, I created a database:
CREATE DATABASE test
WITH
OWNER = "myuser"
ENCODING = 'UTF8'
CONNECTION LIMIT = -1;
I am trying to run the following query:
SET client_encoding = 'UTF8';
DROP TABLE IF EXISTS customers;
CREATE TABLE customers (
customer_id bpchar NOT NULL,
company_name character varying(40) NOT NULL,
contact_name character varying(30),
contact_title character varying(30),
address character varying(60),
city character varying(15),
region character varying(15),
postal_code character varying(10),
country character varying(15),
phone character varying(24),
fax character varying(24)
);
INSERT INTO customers VALUES ('ANATR', 'Ana Trujillo Emparedados y helados', 'Ana Trujillo', 'Owner', 'Avda. de la Constitución 2222', 'México D.F.', NULL, '05021', 'Mexico', '(5) 555-4729', '(5) 555-3745');
I received the following error:
ERROR: invalid byte sequence for encoding "UTF8": 0xf3 0x6e 0x20 0x32
SQL state: 22021
In my local host environment, there are no issues. What could be an issue?
Solution found.
There is an option under Server Parameters in Azure Database for PostgreSQL flexible server:
Inside there client_encoding was set to SQL_ASCII when it requires to be UTF8
After that change query works and pgadmin shows accents correctly.