2

I want a query to create a table with the output of a stored procedure function in Postgres.

SQL:

CREATE TEMP TABLE new_project AS select project_insert('1','test2343','tew3234','ccc',1);

Error:

ERROR:  42P16: column "projects_insert" has pseudo-type record
LOCATION:  CheckAttributeType, heap.c:513

Note: project_insert is a function which insert the values and returns inserted values

1
  • Sorry, its not working Commented Sep 27, 2017 at 10:05

1 Answer 1

1

The problem is that project_insert has been declared with RETURNS record, and that type is illegal for a column definition.

You have to specify name and type of the result columns in the query, like this:

CREATE TEMP TABLE new_project AS
   SELECT x, y, z
   FROM project_insert('1','test2343','tew3234','ccc',1)
        AS p(x integer, y text, z bytea);

Replace the names and types with the appropriate names and types.

See the documentation for details.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.