Skip to content

Create and query in the same page #100

Closed
@ipftalabua

Description

@ipftalabua

I was trying to create a table and query it from within the same SQL page.

Unfortunately, I was greeted with an error message:
Failed to prepare SQL statement: 'SELECT * FROM zzmytable'

Is there a workaround or an easy fix that I can apply?

The minimal working example triggering the above error message is as follows.

select 'shell' as component,
    'Create and query' as title,
    '/dbg-create-query.sql' as link;

select 'list' as component, 'Output' as title;

create table zzmytable as with t
       	(row)
	as (values 
	('A')
	) select * from t;
select * from zzmytable;
drop table zzmytable;

Initially, my aim was to create a temporary table and query that. However, not even permanent tables can be queried like that, as the above example shows. In the context of the psql client the above code is just fine. I would be grateful for any hints.

Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions