So I'm switching from SQL Server 2008 R2 (on Windows Server 2012) to PostgreSQL 9.5 (again on Windows) and all of my existing SQL statements are written in this format:
INSERT INTO Address (Address1, Address4, Address5, Postcode, IsoCountryCode)
VALUES(@P0, @P1, @P2, @P3, @P4)
I'm using Ngpsql v3.1.3 as my .NET library to talk to PostgreSQL with C#. Executing the same statement results in an error that the table Address cannot be found. To get it to work I have to wrap all column names and table names in double quotes like this:
INSERT INTO \"Address\" (\"Address1\", \"Address4\", \"Address5\", \"Postcode\", \"IsoCountryCode\")
VALUES(@P0, @P1, @P2, @P3, @P4)
I have over 600 SQL queries in my application and I don't want to have to go through them all injecting quotes everywhere.
The Npgsql documentation sample does not use quotes so am I missing something? See here Npgsql Documentation Example
Specifically their example has this:
INSERT INTO data (some_field) VALUES ('Hello world')
So I presumed I wouldn't have to double quote things. Can anyone enlighten me?