pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Huxton <dev@archonet.com>
Cc: Andreas Tille <tillea@rki.de>
Cc: PostgreSQL SQL <pgsql-sql@postgresql.org>
Subject: Re: Explicite typecasting of functions
Date: Wed, 14 Aug 2002 11:20:09 -0400
Message-ID: <8505.1029338409@sss.pgh.pa.us> (raw)
In-Reply-To: <200208141210.29995.dev@archonet.com>
References: <Pine.LNX.4.44.0208141123010.8253-100000@wr-linux02.rki.ivbb.bund.de>
	<200208141210.29995.dev@archonet.com>

Richard Huxton <dev@archonet.com> writes:
> On Wednesday 14 Aug 2002 10:30 am, Andreas Tille wrote:
>> Any hint to solve this kind of chicken-egg-problem?

> Your solution is not safe anyway - you could end up with two processes trying
> to insert the next value.

I concur with Richard that Andreas needs to solve a different problem,
but just for the record, the way you could do it is

	CREATE TABLE without mentioning the default

	CREATE FUNCTION

	ALTER TABLE ... SET DEFAULT

Note however that pg_dump is not bright enough to deduce that you did
this.  It will dump the table definition first, with the DEFAULT clause,
and so you'll have to do manual surgery on the dump file if you ever
need to reload.

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <8505.1029338409@sss.pgh.pa.us>
Permalink:  ../8505.1029338409@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8505.1029338409@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dev@archonet.com, tillea@rki.de
  Subject: Re: Explicite typecasting of functions
  In-Reply-To: <8505.1029338409@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox