is it possible to get table name from current query using pdo php or normal sql in postgresql?
In pdo php a function exists like PDOStatement::getColumnMeta
but this function doesn't work well, because it return name of alias in query and when I use notation like
SELECT configuration.id AS other_name
FROM configuration.mytable AS other_table_name
INNER JOIN configuration.some_table AS other_some_table_name
ON other_table_name.id = other_some_table_name.id
it back strange values. I`m interested to get base name of table without aliases. Anybody know better way to get table name of actual query?
Update for Elvis Ciotii answer
Here is sql:
SELECT *
FROM configuration.applications
WHERE url=:url
Here is result
Array
(
[pgsql:oid] => 23
[native_type] => int4
[name] => id
[len] => 4
[precision] => -1
[pdo_type] => 1
)
in documentation php.net function PDOStatement::getColumnMeta() return an associative array containing the following values representing the metadata for a single column:
native_type, driver:decl_type, flags, name, table, len, precision, pdo_type
Where is in my result flags and table key??
I need this value because i`m working at my little framework where i want implements to model class special returnig function with resulting executed queries. I was thinking if i cant get this value from pdo i cant get this value in normal query. etc. SHOW TABLES or something like this.