Using concatenation operator
От | Chris Barnes |
---|---|
Тема | Using concatenation operator |
Дата | |
Msg-id | BLU149-W33402AE5ABDC1F682D0818D49C0@phx.gbl обсуждение исходный текст |
Ответы |
Re: Using concatenation operator
|
Список | pgsql-general |
I have a (stupid) question regarding using concatenation operator.
I would like to get the list of tables from the database and output the select count(*) for each of them
I don't want the schema name proceeding the select, how can I omit without receiving the error below.
psql eventdb001 -t -c "select schemaname||'select count (*) from '||schemaname||'.'||relname from pg_stat_user_tables where relname like 'table_%'"|more
schemaselect count (*) from event001.table_1
schemaselect count (*) from event001.table_2
When I omit the schemaname from in front of the concatenation operator it gives me this error.
psql database -t -c "select ||'select count (*) from '||schemaname||'.'||relname from pg_stat_user_tables where relname like 'table_%'"|more
ERROR: operator does not exist: || unknown
LINE 1: select ||'select count (*) from '||schemaname||'.'||relname ...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts
Chris.
I would like to get the list of tables from the database and output the select count(*) for each of them
I don't want the schema name proceeding the select, how can I omit without receiving the error below.
psql eventdb001 -t -c "select schemaname||'select count (*) from '||schemaname||'.'||relname from pg_stat_user_tables where relname like 'table_%'"|more
schemaselect count (*) from event001.table_1
schemaselect count (*) from event001.table_2
When I omit the schemaname from in front of the concatenation operator it gives me this error.
psql database -t -c "select ||'select count (*) from '||schemaname||'.'||relname from pg_stat_user_tables where relname like 'table_%'"|more
ERROR: operator does not exist: || unknown
LINE 1: select ||'select count (*) from '||schemaname||'.'||relname ...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts
Chris.
В списке pgsql-general по дате отправления: