My end goal is complete a Postgresql function that will need to use a temporary table. Trying to create the temporary table itself isn't working because of a syntax error. I'm pretty sure I have the syntax right so can someone tell me what I'm doing wrong here?
In PGAdmin III, I open a query window and enter the following:
create temporary table tmp_parts
(
id serial not null,
part_number character varying(255) not null,
max_price numeric(19,2) not null
);
When I run the Explain Query feature to test the syntax, I get the following error:
ERROR: syntax error at or near "serial"
LINE 3: id serial not null,
^
********** Error **********
ERROR: syntax error at or near "serial"
SQL state: 42601
Character: 98
What am I doing wrong?
You cannot use create table
in explain
. Only the following is allowed:
Any SELECT, INSERT, UPDATE, DELETE, VALUES, EXECUTE, DECLARE, or CREATE TABLE AS statement, whose execution plan you wish to see.