Re: Bug #918: pg_dump problem w/ SEQUENCE

From: Laurent FAILLIE <l_faillie(at)yahoo(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #918: pg_dump problem w/ SEQUENCE
Date: 2003-03-25 18:28:09
Message-ID: 20030325182809.46952.qmail@web13503.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ok, I found what's append :

1/ current value of the sequence data are following :

scheduling=# select * from seq_id_fch;
sequence_name | last_value | increment_by | max_value
| min_value | cache_value | log_cnt | is_cycled |
is_called
---------------+------------+--------------+------------+-----------+-------------+---------+-----------+-----------
seq_id_fch | 1 | 1 |
2147483647 | 1 | 1 | 0 | f
| t
(1 row)

2/ Line 6083, we have a request to get these
informations :

SELECT sequence_name, last_value, increment_by,
CASE WHEN increment_by > 0 AND max_value =
9223372036854775807 THEN NULL
WHEN increment_by < 0 AND max_value = -1 THEN
NULL
ELSE max_value
END AS max_value,
CASE WHEN increment_by > 0 AND min_value = 1 THEN NULL
WHEN increment_by < 0 AND min_value =
-9223372036854775807 THEN NULL
ELSE min_value
END AS min_value,
cache_value, is_cycled, is_called from seq_id_fch;
sequence_name | last_value | increment_by | max_value
| min_value | cache_value | is_cycled | is_called
---------------+------------+--------------+------------+-----------+-------------+-----------+-----------
seq_id_fch | 1 | 1 |
2147483647 | | 1 | f | t

As you can see, "min_value" is NULL because
CASE WHEN increment_by (=1) > 0 AND min_value (=1) = 1
THEN NULL

3/ Line 6156, we're creating the request
appendPQExpBuffer(query,
"CREATE SEQUENCE %s\n START WITH %s\n
INCREMENT BY %s\n",
fmtId(tbinfo->relname),
(called ? minv : last), incby);
so, with values, it's
seq:'seq_id_fch', [called : 1] ? [minv : ''
(00000000)], [last : '1' (400303eb)]
seq:'x', [called : 0] ? [minv : '' (00000000)], [last
: '1' (400303e2)]

and we create a request w/ a NULL pointer w/
"seq_id_fch" whereas it's ok for "x".

I duno what is the goal of "is_called" field, it's the
only difference b/w "x" and "seq_id_fch", and the only
thing touching "seq_id_fch" is some granting.
Anyway, I think the fault is on request line 6083
because we may create erroneous lines for nothing. Why
can't we take directly informations from sequence data
?

Bye

Laurent

=====
The misspelling master is on the Web.
_________ 100 % Dictionnary Free !
/ /(
/ Dico / / Pleins d'autres fautes sur
/________/ / http://go.to/destroyedlolo
(#######( / http://destroyedlolo.homeunix.org:8080
Quoi, des fautes d'orthographe! Pas possible ;-D.

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Adrian Pop 2003-03-25 18:41:37 Postgresql 7.3.2 Crash
Previous Message Dan Langille 2003-03-25 17:35:34 Re: Backend crashe with signal 11 wher restoring big database.