Polypheny-DB icon indicating copy to clipboard operation
Polypheny-DB copied to clipboard

Adding Data Source Tables containing wildcards '*' breaks schema

Open hennlo opened this issue 2 years ago • 6 comments

Operating System (Polypheny-DB)

Linux

Polypheny-DB Version

v.0.9.0

Affected Areas

DB, UI

Browser

No response

Client Operating System

SLES 15 SP4

Bug Description

When adding a new Data Source within Polypheny and the source tables are selected via wildcard * instead of specifying each table on its own. The system goes ahead an creates a new entity in the public schema called *

Image Pasted at 2023-6-5 10-51

When now trying to view or select this table the schema view breaks and the system behaves very strangely. Image Pasted at 2023-6-5 10-51

Reproduction Steps

  • Within Polypheny try adding a new data source adapter for example on PostgreSQL
  • in the source tables field simply type: *

This "successfully" creates an entity called * which cannot be used.

Expected Behavior

Related to: #449

* The asterix is actually a reserved keyword and shouldn't be allowed in the first place. The original intention was to use *to select all tables within a schema that the user has access to. Without tediously adding table by table.

Even if this is not supported creating an entity with * shouldn't be allowed.

Relevant Log Output

No response

hennlo avatar Jun 07 '23 09:06 hennlo

Hey, i wanna fix this. Can I get some direction to do this?

Yajanth avatar Aug 28 '23 17:08 Yajanth

hi, I'm not sure about the progress of this project, but I'm very interested in it. My proposal is to first validate user input when adding a data source and prevent users from using reserved characters (such as ) as table names. To address this concern, a validation rule supposed to be added to the addAdapter method of Crud.java. Specifically, before proceeding with the adapter addition process, the method checks if the unique name of the adapter is "". AdapterModel a = gson.fromJson(body, AdapterModel.class); if (a.uniqueName.equals("*")) { ctx.json(new Result("Invalid adapter name: '*' is not allowed").setSuccess(false)); return; } If it is, the method returns a Result object containing an appropriate error message indicating that creating an adapter with the name "" is not allowed. This validation rule ensures that no new entity named "" is created in the public schema.Hope my comment can receive further guidance and feedback for ongoing improvement;)

dengjuan0721 avatar Mar 05 '24 02:03 dengjuan0721

@hennlo So what is the objective now, not allowing * (asterix) or implement the logic to select all the available db in the schema If possible assign this issue to me I would be happy to contribute

SWITCHin2 avatar Mar 11 '24 03:03 SWITCHin2

The issue is as pointed out by @dengjuan0721 that an * or other reserved keywords like already existing tables_names in that schema may break the entire schema. Therefore the input should be validated.

hennlo avatar Mar 12 '24 14:03 hennlo

My basic solution is provided in https://github.com/polypheny/Polypheny-DB/pull/479 Please review the proposed solution at your convenience so I can get some instruction in detail

dengjuan0721 avatar Mar 17 '24 05:03 dengjuan0721

I'd like to contribute in this issue . pls assign me.

sumiran18 avatar Aug 11 '24 06:08 sumiran18