Re: easy way to insert same value into 2 columns
| От | Csaba Nagy |
|---|---|
| Тема | Re: easy way to insert same value into 2 columns |
| Дата | |
| Msg-id | 1066298590.10614.25.camel@coppola.ecircle.de обсуждение исходный текст |
| Ответ на | easy way to insert same value into 2 columns (Sebastian Boeck <sebastianboeck@freenet.de>) |
| Ответы |
Re: easy way to insert same value into 2 columns
|
| Список | pgsql-general |
For your specific question I don't know the answer.
For this particular case you could use:
create table your_table (
id integer default nextval ('public.zeit_id_seq'::text),
pos_id integer default currval ('public.zeit_id_seq'::text),
...
);
That would work fine as long as you use inserts which don't specify id
if pos_id is not specified (otherwise the currval will throw you an
error cause it cannot be called without nextval being called).
HTH,
Csaba.
On Thu, 2003-10-16 at 11:40, Sebastian Boeck wrote:
> Hello,
>
> whats the most simple way to insert the same value into 2 colums of
> the same table?
> My table is looking like this:
>
> Spalte | Typ | Attribute
> --------+---------+----------------------
> id | integer | default nextval ('public.zeit_id_seq'::text)
> pos_id | integer | default xxx
>
> for the xxx i want the same value than id be inserted automatically
>
> Regards
>
> Sebastian
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
В списке pgsql-general по дате отправления: