Cannot edit queries when based on several Postgres Schema

======== TEMPLATE BUG FORM ========

Wappler Version : 4.0.0 Beta 6
Operating System : Windows 10
Server Model: PHP
Database Type: Postgres
Hosting Type: IIS

Expected behavior

What do you think should happen?

Be able to edit existing queries in server actions

Actual behavior

What actually happens?

When I open an existing query, a warning says that a table does not exist. However, I am able to refresh the table schema in the database manager. Every time I try to edit the query, the set of existing and not existing tables vary.

How to reproduce

  • Detail a step by step guide to reproduce the issue
  • A screenshot or short video indicating the problem
  • A copy of your code would help. Include: JS, HTML.
  • Test your steps on a clean page to see if you still have an issue
  • Connect to a Postgres database with several schema.
  • Create a server action using tables from different schemas.
  • Save it.
  • Reopen it and try to edit the query.

wappler_error1
wappler_error2
wappler_error3
wappler_error4

@George - Any possible help for this issue ?

Are you working with a different target selected?
Seems your database structure is different.

Make sure you refresh the schema in the database manager first.

I refresh both schemas in the manager first.
But it seems that when I refresh one, it forgets the structure of the other schemas.
For example, it cannot find data_selected.article, so I refresh data_selected. Then it can find it, but it cannot find ariane.accessory_link anymore. So I refresh ariane, then it can find ariane.accessory_link but cannot find data_selected.article anymore.

You can refresh schemas individually by clicking on them and pressing F5 or choosing “refresh schema” from the context menu

Every time I refreh a schema, it cannot find the columns of several tables, but never for the same tables.
Example Refresh 1:
refresh1

Then I refresh again:
refresh2

If I refresh tables 1 by 1, I can get all columns to display in the database manager. But when I try to edit queries it cannot find some tables.

hmm seems like some database errors occur. Do you see any errors in the properties panel, when you click on any of the “no columns info available…”

What is your exact Postgres version and where is it running?

Do you had this problem btw with Wappler 3? Or is it specific to Wappler 4 beta?

I am using
PostgreSQL 12.3, compiled by Visual C++ build 1914, 64-bit
Running on Windows Server 2016 Standard.

image

I had the same issue with Wappler 3.
The server actions work perfectly on the php server.

Please restart Wappler with logging, reproduce the problem and attach the debug log. See:

Here is the log report

report_2021-5-11_13-6-1.zip (114.4 KB)

I don’t actually see any errors in the log. Did you try refreshing those tables and schemas in the database manager? where you got errors on the other schema. I would really like to see a log of that.

Hi George,

I found a manual work-around, but not very convenient on the long term.
I went to the .wappler/targets/targetname/databases/ folder and opened the connection json. I manually added all the database structure, restarted Wappler. I could edit the query.

Then, I went back to the database manager, refreshed one table schema. The issue came back.

I checked on the connection json. Only the structure of that schema stayed, the structure of all other schemas disappeared.
So I decided to check on what happens when I refresh other tables. Every time I refresh a table in the database manager, it drops the structure of the other schemas. I don’t know why it does it this way. But I understand why I cannot edit queries based on several schemas, because it can keep in memory only the structure of one schema.

I attach the json files created after each time I refreshed table structure from different schema.

connection_schema.zip (1.3 KB)

1 Like

I will investigate - yes Postgres is the only database have multiple databases (schemas) inside.

How exactly did you do the refresh?

In the Database Manager, right click on a table, then choose refresh schema

What if you refresh per schema?

I cannot refresh schemas, but I can refresh Tables of schema. That will show only the table names of the schema, not their columns. If the JSON, I can see strcuture of the first schema and table names of the second.
I need to refresh each table to get its columns, and then I lose the structure of first schema.

I mean choose the database schema name i the database manager and hit refresh there. Then select the other schema and do the same.

It collapses everything, and nothing else : if I reexpand one by one, I see the same thing as before, and no change in the json file.