pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
strange corruption?
5+ messages / 4 participants
[nested] [flat]

* strange corruption?
@ 2012-12-27 14:27 John Fabiani <johnf@jfcomputer.com>
  2012-12-27 16:21 ` Re: strange corruption? Gavin Flower <GavinFlower@archidevsys.co.nz>
  2012-12-27 21:27 ` Re: strange corruption? Scott Marlowe <scott.marlowe@gmail.com>
  2012-12-28 03:26 ` Re: strange corruption? msi77 <msi77@yandex.ru>
  0 siblings, 3 replies; 5+ messages in thread

From: John Fabiani @ 2012-12-27 14:27 UTC (permalink / raw)
  To: pgsql-sql

Hi,
I have the following statement in a function.

     UPDATE orderseq
     SET orderseq_number = (orderseq_number + 1)
     WHERE (orderseq_name='InvcNumber');

All it does is update a single record by incrementing a value (int).

But it never completes.  This has to be some sort of bug.  Anyone have a 
thought what would cause this to occur.  To my knowledge it was working 
and does work in other databases.

Johnf


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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: strange corruption?
  2012-12-27 14:27 strange corruption? John Fabiani <johnf@jfcomputer.com>
@ 2012-12-27 16:21 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
  2012-12-27 20:20   ` Re: strange corruption? Gavin Flower <GavinFlower@archidevsys.co.nz>
  2 siblings, 1 reply; 5+ messages in thread

From: Gavin Flower @ 2012-12-27 16:21 UTC (permalink / raw)
  To: johnf@jfcomputer.com; +Cc: pgsql-sql

On 28/12/12 03:27, John Fabiani wrote:
> Hi,
> I have the following statement in a function.
>
>     UPDATE orderseq
>     SET orderseq_number = (orderseq_number + 1)
>     WHERE (orderseq_name='InvcNumber');
>
> All it does is update a single record by incrementing a value (int).
>
> But it never completes.  This has to be some sort of bug.  Anyone have 
> a thought what would cause this to occur.  To my knowledge it was 
> working and does work in other databases.
>
> Johnf
>
>
It might help if you give the table definition.

Definitely important: is the exact version of PostgreSQL used, and the 
operating system.


Cheers,
Gavin

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: strange corruption?
  2012-12-27 14:27 strange corruption? John Fabiani <johnf@jfcomputer.com>
  2012-12-27 16:21 ` Re: strange corruption? Gavin Flower <GavinFlower@archidevsys.co.nz>
@ 2012-12-27 20:20   ` Gavin Flower <GavinFlower@archidevsys.co.nz>
  0 siblings, 0 replies; 5+ messages in thread

From: Gavin Flower @ 2012-12-27 20:20 UTC (permalink / raw)
  To: johnf@jfcomputer.com; +Cc: pgsql-sql

On 28/12/12 05:44, John Fabiani wrote:
> On 12/27/2012 08:21 AM, Gavin Flower wrote:
>> On 28/12/12 03:27, John Fabiani wrote:
>>> Hi,
>>> I have the following statement in a function.
>>>
>>>     UPDATE orderseq
>>>     SET orderseq_number = (orderseq_number + 1)
>>>     WHERE (orderseq_name='InvcNumber');
>>>
>>> All it does is update a single record by incrementing a value (int).
>>>
>>> But it never completes.  This has to be some sort of bug. Anyone 
>>> have a thought what would cause this to occur.  To my knowledge it 
>>> was working and does work in other databases.
>>>
>>> Johnf
>>>
>>>
>> It might help if you give the table definition.
>>
>> Definitely important: is the exact version of PostgreSQL used, and 
>> the operating system.
>>
>>
>> Cheers,
>> Gavin 
> 9.1.6 updated 12.22.2012, openSUSE 12.1 64 bit Linux
>
> CREATE TABLE orderseq
> (
>   orderseq_id integer NOT NULL DEFAULT 
> nextval(('orderseq_orderseq_id_seq'::text)::regclass),
>   orderseq_name text,
>   orderseq_number integer,
>   orderseq_table text,
>   orderseq_numcol text,
>   CONSTRAINT orderseq_pkey PRIMARY KEY (orderseq_id )
> )
> WITH (
>   OIDS=FALSE
> );
> ALTER TABLE orderseq
>   OWNER TO admin;
> GRANT ALL ON TABLE orderseq TO admin;
> GRANT ALL ON TABLE orderseq TO xtrole;
> COMMENT ON TABLE orderseq
>   IS 'Configuration information for common numbering sequences';
>
>
> Johnf

I had a vague idea what the problem might be, but your table definition 
proved I was wrong!  :-)


This won't sole your problem, but I was wondering why you don't use a 
simpler definition like:

CREATE TABLE orderseq
(
   orderseq_id       SERIAL PRIMARY KEY,
   orderseq_name     text,
   orderseq_number   integer,
   orderseq_table    text,
   orderseq_numcol   text
);

SERIAL automatically attaches the table's own sequence and does a 
DEFAULT nextval

PRIMARY KEY implies NOT NULL & UNIQUE

OIDS=FALSE is the default

My personal preference is just to use the name 'id' for the tables own 
primary key, and only prepend the table name when it is foreign key - 
makes them stand out more.


Cheers,
Gavin

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: strange corruption?
  2012-12-27 14:27 strange corruption? John Fabiani <johnf@jfcomputer.com>
@ 2012-12-27 21:27 ` Scott Marlowe <scott.marlowe@gmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Scott Marlowe @ 2012-12-27 21:27 UTC (permalink / raw)
  To: johnf@jfcomputer.com; +Cc: pgsql-sql

On Thu, Dec 27, 2012 at 7:27 AM, John Fabiani <johnf@jfcomputer.com> wrote:
> Hi,
> I have the following statement in a function.
>
>     UPDATE orderseq
>     SET orderseq_number = (orderseq_number + 1)
>     WHERE (orderseq_name='InvcNumber');
>
> All it does is update a single record by incrementing a value (int).
>
> But it never completes.  This has to be some sort of bug.  Anyone have a
> thought what would cause this to occur.  To my knowledge it was working and
> does work in other databases.

There are many reasons this may or may not be working.  Can you create
a self-contained test case that reproduces this issue?


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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: strange corruption?
  2012-12-27 14:27 strange corruption? John Fabiani <johnf@jfcomputer.com>
@ 2012-12-28 03:26 ` msi77 <msi77@yandex.ru>
  2 siblings, 0 replies; 5+ messages in thread

From: msi77 @ 2012-12-28 03:26 UTC (permalink / raw)
  To: johnf@jfcomputer.com <johnf@jfcomputer.com>; +Cc: pgsql-sql

Hi,
Maybe you have triggers on the target table.

27.12.2012, 18:28, "John Fabiani" <johnf@jfcomputer.com>:
> Hi,
> I have the following statement in a function.
>
>      UPDATE orderseq
>      SET orderseq_number = (orderseq_number + 1)
>      WHERE (orderseq_name='InvcNumber');
>
> All it does is update a single record by incrementing a value (int).
>
> But it never completes.  This has to be some sort of bug.  Anyone have a
> thought what would cause this to occur.  To my knowledge it was working
> and does work in other databases.
>
> Johnf
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql


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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2012-12-28 03:26 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-12-27 14:27 strange corruption? John Fabiani <johnf@jfcomputer.com>
2012-12-27 16:21 ` Gavin Flower <GavinFlower@archidevsys.co.nz>
2012-12-27 20:20   ` Gavin Flower <GavinFlower@archidevsys.co.nz>
2012-12-27 21:27 ` Scott Marlowe <scott.marlowe@gmail.com>
2012-12-28 03:26 ` msi77 <msi77@yandex.ru>

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