[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
file_transaction_id_key duplicates
- Subject: file_transaction_id_key duplicates
- From: Michael Richardson <..hidden..>
- Date: Sun, 14 Jun 2015 13:43:55 -0400
On an accounts payable transaction that was copy-to-new, but not yet posted,
I attached a file (the invoice from the vendor), and I get:
DBD::Pg::st execute failed: ERROR: duplicate key value violates unique constraint "file_transaction_id_key"
DETAIL: Key (id)=(3) already exists.
CONTEXT: SQL statement "INSERT INTO file_transaction
(content, mime_type_id, file_name, description, ref_key,
file_class, uploaded_by, uploaded_at)
VALUES (in_content, in_mime_type_id, in_file_name, in_description,
in_ref_key, in_file_class, person__get_my_entity_id(),
now())"
PL/pgSQL function "file__attach_to_tx" line 16 at SQL statement at LedgerSMB.pm line 586, <_GEN_0> line 480.
2015/06/14 17:36:13 - ERROR - LedgerSMB::dberror LedgerSMB.pm (773) -- Logging SQL State 23505, error 7, string ERROR: duplicate key value violates unique constraint "file_transaction_id_key"
DETAIL: Key (id)=(3) already exists.
CONTEXT: SQL statement "INSERT INTO file_transaction
(content, mime_type_id, file_name, description, ref_key,
file_class, uploaded_by, uploaded_at)
VALUES (in_content, in_mime_type_id, in_file_name, in_description,
in_ref_key, in_file_class, person__get_my_entity_id(),
now())"
PL/pgSQL function "file__attach_to_tx" line 16 at SQL statement
2015/06/14 17:36:13 - ERROR - LedgerSMB::_error LedgerSMB.pm (650) -- Conflict with Existing Data. Perhaps you already entered this?
More information has been reported in the error logs at LedgerSMB.pm line 776, <_GEN_0> line 480.
The addition to Accounts Payable is also wrong.
http://www.sandelman.ca/tmp/mcrcapture/2374.2015-06-14/capture1.png
Unclicking the "GST" value gets it to be correct, which is incorrect.
http://www.sandelman.ca/tmp/mcrcapture/6810.2015-06-14/capture1.png
I also wish that it didn't say "Draft Posted", but showed me the posted
document, or at least let me link back to it. Attaching the file also
fails after posting. Given that the duplicate key_id is so small (3),
and I don't see it in the insert, it must come from an autoincrement...
sswbooks=# \d file_transaction
Table "public.file_transaction"
Column | Type | Modifiers
--------------+-----------------------------+--------------------------------------------------------
content | bytea | not null
mime_type_id | integer | not null
file_name | text | not null
description | text |
uploaded_by | integer | not null
uploaded_at | timestamp without time zone | not null default now()
id | integer | not null default nextval('file_base_id_seq'::regclass)
ref_key | integer | not null
file_class | integer | not null
This looks sane.
sswbooks=# \d+ file_base_id_seq
Sequence "public.file_base_id_seq"
Column | Type | Value | Storage | Description
---------------+---------+---------------------+---------+-------------
sequence_name | name | file_base_id_seq | plain |
last_value | bigint | 5 | plain |
start_value | bigint | 1 | plain |
increment_by | bigint | 1 | plain |
max_value | bigint | 9223372036854775807 | plain |
min_value | bigint | 1 | plain |
cache_value | bigint | 1 | plain |
log_cnt | bigint | 31 | plain |
is_cycled | boolean | f | plain |
is_called | boolean | t | plain |
And weirdly, I see "last_value" is 5, and not 3...
select file_name,id from file_transaction;
shows me values up to 69...
sswbooks=# select setval('file_base_id_seq', 70);
and now I can upload files... I wonder what reset the sequence then?
I understand that 1.5 will be frameless and more RESTful... be nice
to automate my mobile phone bill processing :-)
------------------------------------------------------------------------------
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel