You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hawq.apache.org by zhangh43 <gi...@git.apache.org> on 2016/01/05 04:33:26 UTC

[GitHub] incubator-hawq pull request: HAWQ-293. Enable writable external ta...

Github user zhangh43 commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/229#discussion_r48809821
  
    --- Diff: src/backend/commands/tablecmds.c ---
    @@ -17666,6 +17666,12 @@ static Datum transformExecOnClause(List	*on_clause, int *preferred_segment_num)
     		}
     		else if (strcmp(defel->defname, "master") == 0)
     		{
    +			if(iswritable){
    +			  ereport(ERROR,
    +	 	      (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
    +			    errmsg("the ON master syntax for writable external tables is deprecated"),
    --- End diff --
    
    Only ON number is allowed, e.g. ON 3 will start 3 virtual segments to run the query.
    
    Here's an example to create a writable external table in Hawq 2.0:
    postgres=# create table a (i int);
    CREATE TABLE
    postgres=# insert into a values(1);
    INSERT 0 1
    postgres=# insert into a values(2);
    INSERT 0 1
    postgres=# insert into a values(10);
    INSERT 0 1
    postgres=# CREATE WRITABLE EXTERNAL WEB TABLE externala (output text)         EXECUTE 'cat > /tmp/externala' on 3 FORMAT 'TEXT'   DISTRIBUTED RANDOMLY;
    CREATE EXTERNAL TABLE
    postgres=# insert into externala select * from a;
    INSERT 0 3
    
    You can check the result file in /tmp/externala:
    1
    2
    10


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---