Search Postgresql Archives

Re: CREATE TABLE LIKE and SERIAL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 30, 2009 at 8:44 AM, Mark Morgan Lloyd
<markMLl.pgsql-general@xxxxxxxxxxxxxxx> wrote:
What is the "correct" behavior of a serial column when a table is created
with LIKE? The manual is silent on this.

What appears to be happening with 8.2 is that the column in the new table
refers to the original sequence generator.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

silly8888 wrote:
> In 8.4, the sequence value is copied only when INCLUDING DEFAULTS is
> specified. Otherwise, only the not null constraint is copied. I think
> this is the most reasonable behavior and I don't see why it should
> have been explicitly stated in the manual.

I didn't say the sequence value, I said the sequence itself. After all the normal usage will be where the "pattern" table is empty.

In other words the newly-created table is not completely decoupled from the pattern, the sequence is a shared resource and this is irrespective of any including/excluding specification.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux