Skip to content

pgml.train does not properly escape relation_name #1326

Closed
@kalensk

Description

@kalensk

It appears pgml.train does not properly escape the relation_name.

Relations can start with numbers and contain all kinds of crazy characters. Postgres allows these relations by using the syntax "schema"."relation_name" to escape such as:

postgres=# select count(*) from "public"."08e56f36-7c89-4eea-9b17-0ab9785e6b2b_pgml";
 count 
-------
 10000
(1 row)

However, pgml.trian fails to find the relation when escaping the relation_name as follows:

postgres=# SELECT * FROM pgml.train('my_project', 'classification', '"public"."08e56f36-7c89-4eea-9b17-0ab9785e6b2b_pgml"', 'failure', 'xgboost');
INFO:  Snapshotting table ""public"."08e56f36-7c89-4eea-9b17-0ab9785e6b2b_pgml"", this may take a little while...
ERROR:  Relation ""public"".""08e56f36-7c89-4eea-9b17-0ab9785e6b2b_pgml"" doesn't exist (snapshot.rs:747)

Or if you prefer without quotes:

postgres=# SELECT * FROM pgml.train('my_project', 'classification', 'public.08e56f36-7c89-4eea-9b17-0ab9785e6b2b_pgml', 'failure', 'xgboost');
INFO:  Snapshotting table "public.08e56f36-7c89-4eea-9b17-0ab9785e6b2b_pgml", this may take a little while...
ERROR:  syntax error at or near ".08e56"
LINE 1: ... "tool_wear_time", "torque", "failure" FROM public.08e56f36-...
                                                             ^
QUERY:  SELECT "process_temp", "tool_wear_time", "torque", "failure" FROM public.08e56f36-7c89-4eea-9b17-0ab9785e6b2b_pgml

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions