Hinting when creating CTE

Kcko's profile image Kcko posted 2 months ago in General Permalink

Hi Ansgar,

Would it be possible to use some magic to make the CTE columns suggest the same way as when suggesting from the actual table?

Short video: https://is.gd/2NOfYH

ansgar's profile image ansgar posted 2 months ago Permalink

You mean the id column from the dynamic cte result/table? Well, that's not a real table which can be parsed before the result exists. The only thing I could think of is parsing the query with a regex, for instance:

WITH\s+(\S+)\s+AS\s+\(\s*SELECT\s+(.*)\)

... and then use the first group as the table name, and the second one for the column names. That would of course not know the data types of the columns. Also, if you use table aliases, the parsing would go up in horror I'm afraid.

Kcko's profile image Kcko posted 2 months ago Permalink

Hi, this is exactly what I mean. Looks difficult, i thought that should be nice feature, it doesnt mean MUST TO HAVE :) Forgot :-) thx for reply.

Please login to leave a reply, or register at first.