From: Michael P. <mic...@gm...> - 2010-05-24 07:24:46
|
Hi, I noticed a couple of days ago that it is actually not possible to execute directly to Datanodes a query with string elements. For example: 1) execute direct on node 1 'select * from pg_proc where proname = 'foo''; It doesn't work because the query is seen as a unique string for the parser. Parser on coordinator returns an error. 2) execute direct on node 1 'select * from pg_proc where proname = foo'; This one also doesn't work because foo has to be a string. Datanode returns an error. Here is my proposition to correct that: I don't know for the others, but basically I use execute direct only with select queries to see if data is correctly present on data nodes, for debugging, etc. Why not replacing the string query 'Sconst' in EXECUTE DIRECT by a select_with_parens? This grammar is used by COPY (SELECT) With that, even if the use of execute direct is restricted to Select queries only, I feel that it becomes more useful. The new grammar would become: EXECUTE DIRECT ON { COORDINATOR | NODE list_of_nodes } ( SELECT query ); Any opinions? Regards, -- Michael Paquier NIPPON TELEGRAPH AND TELEPHONE CORPORATION NTT Open Source Software Center |
From: Andrei M. <and...@en...> - 2010-05-24 08:23:44
|
Michael, Try this: execute direct on node 1 'select * from pg_proc where proname = ''foo'''; Command in EXECUTE DIRECT is not necessarily SELECT, but also any DDL or DML statement. 2010/5/24 Michael Paquier <mic...@gm...>: > Hi, > > I noticed a couple of days ago that it is actually not possible to execute > directly to Datanodes a query > with string elements. For example: > > 1) execute direct on node 1 'select * from pg_proc where proname = 'foo''; > It doesn't work because the query is seen as a unique string for the parser. > Parser on coordinator returns an error. > > 2) execute direct on node 1 'select * from pg_proc where proname = foo'; > This one also doesn't work because foo has to be a string. > Datanode returns an error. > > Here is my proposition to correct that: > I don't know for the others, but basically I use execute direct only with > select queries > to see if data is correctly present on data nodes, for debugging, etc. > Why not replacing the string query 'Sconst' in EXECUTE DIRECT by a > select_with_parens? > This grammar is used by COPY (SELECT) > With that, even if the use of execute direct is restricted to Select queries > only, > I feel that it becomes more useful. > > The new grammar would become: > EXECUTE DIRECT ON > { COORDINATOR | NODE list_of_nodes } > ( SELECT query ); > > Any opinions? > Regards, > > -- > Michael Paquier > NIPPON TELEGRAPH AND > TELEPHONE CORPORATION > NTT Open Source Software Center > > ------------------------------------------------------------------------------ > > > _______________________________________________ > Postgres-xc-developers mailing list > Pos...@li... > https://lists.sourceforge.net/lists/listinfo/postgres-xc-developers > > -- Andrei Martsinchyk EntepriseDB Corporation The Enterprise Postgres Company Website: www.enterprisedb.com EnterpriseDB Blog: http://blogs.enterprisedb.com/ Follow us on Twitter: http://www.twitter.com/enterprisedb This e-mail message (and any attachment) is intended for the use of the individual or entity to whom it is addressed. This message contains information from EnterpriseDB Corporation that may be privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient or authorized to receive this for the intended recipient, any use, dissemination, distribution, retention, archiving, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and delete this message. |
From: Michael P. <mic...@gm...> - 2010-05-25 00:52:10
|
Ok Thanks, I was a little bit lost with the grammar. This is not yet documented in the reference manual and should be added. -- Michael Paquier NIPPON TELEGRAPH AND TELEPHONE CORPORATION NTT Open Source Software Center |