Re: [SQL] strange corruption?
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_tabletext, 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
Re: [SQL] strange corruption?
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
Re: [SQL] strange corruption?
Hi, Maybe you have triggers on the target table. 27.12.2012, 18:28, "John Fabiani" : > 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
Re: [SQL] strange corruption?
On Thu, Dec 27, 2012 at 7:27 AM, 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. 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
[SQL] strange corruption?
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