Creation of a temporary table in postgres

I’m trying to create a temporary table in Postgres (to speed up joining, as there will be a lot of similar queries throughout a session). The SQL that will be called at the beginning of a session is the following:

CREATE TEMPORARY TABLE extended_point AS
SELECT (
  point.id,
  local_location,
  relative_location,
  long_lat,
  region,
  dataset,
  region.name,
  region.sub_name,
  color,
  type)
FROM point, region, dataset
WHERE point.region = region.id AND region.dataset = dataset.id;

The tables point has the columns id::int, region::int, local_location::point, relative_location::point, long_lat:point (longitude, latitude).

Region has the columns id::int, color::int, dataset::int, name::varchar, sub_name::varchar.

Dataset has the columns id::int, name::varchar, type:varchar.

When this is run, I get the error message: [25P02] ERROR: current transaction is aborted, commands ignored until end of transaction block.

As a side, the commands are executed in PyCharm, and is part of a Python project.

Any suggestions?

Thanks in advance 🙂


Source: sql

Leave a Reply