forcedotcom / phoenix

BSD 3-Clause "New" or "Revised" License
558 stars 227 forks source link

add "CREATE TABLE table_a LIKE table_b" syntax #603

Closed haitaoyao closed 10 years ago

haitaoyao commented 10 years ago

Add create table like syntax:

antlr definition:

create_table_like_node returns [CreateTableLikeStatement ret]
    :   CREATE TABLE new_table=from_table_name LIKE base_table=from_table_name
        {ret = factory.createTableLike(new_table, base_table, getBindCount());}
    ;

and the sql will be like this:

CREATE TABLE test LIKE table_b;
haitaoyao commented 10 years ago

May I just support create simple data table and filter out the INDEX and SYSTEM table? @jtaylor-sfdc

jtaylor-sfdc commented 10 years ago

@haitaoyao - we appreciate your interest in contributing. Can you tell us a bit more about your use case?

jtaylor-sfdc commented 10 years ago

This is a duplicate of #592 - we'll use this LIKE syntax to model multi-tenant tables as well as providing this ability as well.