[ https://issues.apache.org/jira/browse/DERBY-4?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12496107
]
Bryan Pendleton commented on DERBY-4:
-------------------------------------
Thanks Christian and Dan for the feedback. I agree about the contiguous
values, Dan. The guarantee that I think it can make is that the values are
monotonically increasing; that is, that the rows that are inserted, if later
sorted by their auto-generated field, will be in the same order as they came
from the SELECT. So it's preserving the order, which is all that is needed
for my application (I'm using a "temporary" table for supporting paging in a UI,
and wish to preserve the the order of the rows as they arrive in that table.)
Christian, regarding the ranking functions, I'm quite interested in those, and
I think we should log them as an enhancement request and pursue them.
Perhaps you have already done so? If not I think that would be great.
However, in my particular case I don't have control over the SQL that is
being emitted; I'm trying to get Derby to work with a tool written for another DBMS.
> "order by" is not supported for "insert ... select"
> ---------------------------------------------------
>
> Key: DERBY-4
> URL: https://issues.apache.org/jira/browse/DERBY-4
> Project: Derby
> Issue Type: New Feature
> Components: SQL
> Reporter: Christian d'Heureuse
> Assigned To: Bryan Pendleton
> Priority: Minor
>
> When filling a table with "insert ... select ...", "order by" cannot be specified.
> There is not method to copy a table sorted into another table (except using export/import).
This would be useful to optimize performance for big tables, or to create identity values
that are ascending (related to another column).
> Example:
> create table temp1 (
> s varchar(10));
> insert into temp1 values 'x','a','c','b','a';
> create table temp2 (
> i integer not null
> generated always as identity
> primary key,
> s varchar(10));
> insert into temp2 (s)
> select s from temp1 order by s;
> --> Error: "order by" is not allowed.
> -- trying to use "group by" instead of "oder by":
> insert into temp2 (s)
> select s from temp1 group by s;
> select * from temp2;
> --> "group by" did not sort the table.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.