Can you really specify an alias reputation for the table I'm placing values into?

I wish to specify an ailment in the nested query and also the table is simply too verbose...

Something similar to turning this:

INSERT INTO my_table_with_a_very_long_name (col_a, col_b, col_c)
SELECT foo, bar, baz
FROM other_table
WHERE
  other_table.some_value > 
  (SELECT max(other_value) FROM my_table_with_a_very_long_name);

into this:

INSERT INTO my_table_with_a_very_long_name AS t (col_a, col_b, col_c)
SELECT foo, bar, baz
FROM other_table
WHERE
  other_table.some_value > (SELECT max(other_value) FROM t);

(clearly my situation is longer and involves a couple of references more)

You do not alias a table, you alias a clear case of a table reference.

This enables self joins, etc as you've mutliple cases of references towards the same physical table. It isn't a situation where each AS gives that table a brand new title elsewhere, it is simply an alias to consult That specific reference.


Inside your situation, you will find two show corks...

The table being placed into is not itself area of the choose query, it isn't a recommended occur exactly the same way as foo, bar or baz for instance. So, you cannot alias it whatsoever (because you shouldn't have, it may not be recommended).

Also, even when it had been, you cannot reference the entire table with an alias. You reference a area, as an ingredient the query itterating with the set. For instance, this does not work either...

SELECT * FROM myTable AS xxx WHERE id = (SELECT MAX(id) FROM xxx)

You will get round the latter example using...

WITH xxx AS (Choose * FROM myTable) Choose * FROM xx WHERE id = (Choose MAX(id) FROM xxx)

But that also brings us to the very first point, the table being placed into never will get recommended within the query a part of your statement.

The only method I'm able to think about getting close is to produce a view...

No. Why would you like to get it done? Just appearance?

i believe the solution in NO. There's no AS following the tableName

INSERT INTO table [ ( column [, ...] ) ]
    { DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }
    [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]

Reference