Escape Keys - TomdeMan's Blog
MachBlog Postgre Fix

I was using MachBlog with MS SQL Server and had very little trouble. I made the switch to Postgre and things started to blow up.

I made some updates and before I send it over to Pete and Matt, I'm gonna throw it up here for anyone to grab.

There was an extra field, isHidden, and some other bugs. I also cleaned up the DB creation scirpt. Reordered a field to match the other scripts. Not much of a difference there, but it helps with Import / Export if you don't have a good tool for that.

I zipped the entire PostgreSQL databaseObjects directory and the SQL script.

machblog_postgre_fix.zip

Postgre Error: Relation does not exist

I'm working on an app that integrates with the Transfer ORM. The code runs on an MS SQL and MySQL database without a problem. However, when switching over to Postgre one table causes things to flop.

When it queries the table i get the error: relation "tableName" does not exist.

I look at the SQL involved and its a basic select. So I try select * tableName, and get the same error in the query window.

If I add double quotes around "tableName" it works fine.

That's a solution but not an explanation for the problem.

Why is it, that for this tableName, I need the double quotes?

Well it can be one of two things...

The tableName is a reserved word in Postgre or when you created the table you used mixed cases (tableName) or upper case (TABLENAME). Had you created the table lower case (tablename) then you would have never seen this error. So if you are using an ORM that extends itself to Postgre be sure to create tables and column names in lower case.