Hi,

I figured out a way in which i call getName on the original generated 
column and do a select on the new table. That seems to work well for post 
gres.
I am very new to sql so i am not sure if this is a best practice of using 
only the column name without the schema and table names.

Thanks,
Gokul

On Wednesday, July 9, 2014 4:10:10 PM UTC+5:30, [email protected] wrote:
>
> Thanks Lukas.
> That fills the bill nicely.
>  
> Is there any way i can use the earlier jooq generated column names to 
> refer to the columns names in the table  or should i use sql builder with 
> strings to query this table.
>
> Thanks,
> Gokul
>
>
>
>
>
>
>
> On Wednesday, July 9, 2014 3:26:41 PM UTC+5:30, Lukas Eder wrote:
>>
>> Hello,
>>
>> This is currently not supported by jOOQ and we probably won't support it 
>> as PostgreSQL documentation recommends using the CREATE TABLE AS syntax 
>> instead of SELECT INTO.
>>
>> Note that other databases including the SQL standard specify SELECT INTO 
>> as follows:
>>
>> <select statement: single row> ::=
>>   SELECT [ <set quantifier> ] <select list>
>>     INTO <select target list>
>>     <table expression>
>>
>> <select target list> ::=
>>   <target specification> [ { <comma> <target specification> }... ]
>>
>>
>> So, INTO expects column references or parameters, for instance, not table 
>> references.
>>
>> Now, CREATE TABLE AS can be used with jOOQ using plain SQL as follows:
>>
>> DSL.using(configuration)
>>
>>    .execute("CREATE TABLE xx AS {0}", select);
>>
>>
>> Where select is your jOOQ SELECT statement.
>>
>> In any case, the CREATE TABLE AS statement would be a useful addition to 
>> the newly introduced set of DDL statements in jOOQ. I have added it to the 
>> roadmap for jOOQ 3.5:
>> https://github.com/jOOQ/jOOQ/issues/3381
>>
>> Cheers
>> Lukas
>>
>> 2014-07-09 11:16 GMT+02:00 <[email protected]>:
>>
>>> Hi,
>>>
>>> postgres has a select into which allows defining a new table from the 
>>> results of a query. Is there any way i can do this in jooq? 
>>>
>>> http://www.postgresql.org/docs/9.3/static/sql-selectinto.html
>>>
>>> i have a use case where i create a complex query containing a number of 
>>> joins and a number of conditions to get a result set.
>>> On this result set i need to compute different aggregate values which 
>>> are then used for plotting a graph.
>>>
>>> I thought it would be more efficent to push the results of the first 
>>> query into a temp table and then do the later computation on the temporary 
>>> table.
>>>
>>> Thanks,
>>> Gokul
>>>  
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "jOOQ User Group" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to