Row ordering after CREATE TABLE AS...SELECT regexp_split_to_table(source_text, regexp) AS new_column

Поиск
Список
Период
Сортировка
От John Gage
Тема Row ordering after CREATE TABLE AS...SELECT regexp_split_to_table(source_text, regexp) AS new_column
Дата
Msg-id 96D8D908-9469-4437-B175-9D24A5AD9743@numericable.fr
обсуждение исходный текст
Ответы Re: Row ordering after CREATE TABLE AS...SELECT regexp_split_to_table(source_text, regexp) AS new_column  ("Bret S. Lambert" <bret.lambert@gmail.com>)
Re: Row ordering after CREATE TABLE AS...SELECT regexp_split_to_table(source_text, regexp) AS new_column  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
This is a two-part question:

1) I have a source_text that I want to divide into smaller subunits
that will be contained in rows in a column in a new table.  Is it
absolutely certain that the initial order of the rows in the resultant
table after this  operation:

CREATE TABLE new_table AS SELECT regexp_split_to_table(source_text,
E'regexp') as subunits FROM source_table;

will be the same as the order of these subunits in the original text?
Emphasis *initial order*.

2) I would like to be able to create a serial-type column during
CREATE TABLE AS in the new table that "memorizes" this order so that I
can reconstruct the original text using ORDER BY on that serial
column.  However, I am stumped how to do that.  I do not see how to
put the name of that column into my SELECT statement which generates
the table, and I do not see where else to put it.  Please forgive my
stupidity.

The "work-around" to this problem has been to ALTER my table after its
creation with a new serial-type column.  But this assumes that the
answer to Question 1) above is always "Yes".

Thanking you for your understanding,

John


В списке pgsql-general по дате отправления:

Предыдущее
От: Jignesh Shah
Дата:
Сообщение: Re: Not able to change the owner of function
Следующее
От: "Bret S. Lambert"
Дата:
Сообщение: Re: Row ordering after CREATE TABLE AS...SELECT regexp_split_to_table(source_text, regexp) AS new_column