Mike Huls
Aug 31, 2021

--

Hello Scott,

The cause of the problem is that my sql was written for sql server. Postgres has a slightly different syntax:

- In sql server #TableName creates a temporary table. In postgres we have to CREATE TEMP TABLE TableName.

- SqlServer IDENTITY = postgres SERIAL

- NVARCHAR(MAX) = postgres TEXT

- the getdate() function is now() in postgres

The code below should work:

CREATE TEMP TABLE ErrorMessages (

Id SERIAL PRIMARY KEY

, ErrorTimeStamp TIMESTAMP DEFAULT now()

, ErrorCode INT

, ErrorMessage TEXT

, ReportedBy TEXT

);

Happy coding and thanks for your response!

-mike

--

--

Mike Huls
Mike Huls

Written by Mike Huls

I write about interesting programming-related things: techniques, system architecture, software design and how to apply them in the best way. — mikehuls.com

Responses (1)