Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pgsql integer out of range when updated workflow_runs table. 6824241167 total_tokens exceed intger, please use biginteger #12207

Closed
5 tasks done
yuhua6379 opened this issue Dec 30, 2024 · 4 comments · Fixed by #12279
Assignees
Labels
🐞 bug Something isn't working

Comments

@yuhua6379
Copy link

yuhua6379 commented Dec 30, 2024

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.14.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

pgsql log

2024-12-30 13:32:19 2024-12-30 05:32:19.413 UTC [26134] ERROR:  integer out of range
2024-12-30 13:32:19 2024-12-30 05:32:19.413 UTC [26134] STATEMENT:  UPDATE workflow_runs SET status='succeeded', outputs='{"template": "", "blank_list": [{"blank": "\u9879\u76ee\u540d\u79f0", "placeholder": "{{0}}"}, {"blank": "\u6750\u6599\u540d\u79f0", "placeholder": "{{1}}"}, {"blank": "\u62db\u6807\u7f16\u53f7", "placeholder": "{{2}}"}, {"blank": "\u9879\u76ee\u6240\u5728\u5730\u533a", "placeholder": "{{3}}"}, {"blank": "\u9879\u76ee\u516c\u53f8\u540d\u79f0", "placeholder": "{{4}}"}, {"blank": "\u5efa\u8bbe\u5730\u70b9", "placeholder": "{{5}}"}, {"blank": "\u89c4 \u6a21", "placeholder": "{{6}}"}, {"blank": "\u5efa\u8bbe\u5de5\u671f", "placeholder": "{{7}}"}, {"blank": "\u6807\u6bb5\u5212\u5206", "placeholder": "{{8}}"}, {"blank": "\u672c\u6b21\u62db\u6807\u91c7\u8d2d\u6750\u6599\u7684\u540d\u79f0\u3001\u6570\u91cf\u3001\u6280\u672f\u89c4\u683c", "placeholder": "{{9}}"}, {"blank": "\u4ea4\u8d27\u5730\u70b9", "placeholder": "{{10}}"}, {"blank": "\u4ea4\u8d27\u671f", "placeholder": "{{11}}"}, {"blank": "\u4e1a\u7ee9\u8981\u6c42", "placeholder": "{{12}}"}, {"blank": "\u8d44\u8d28\u7b49\u7ea7\u8981\u6c42", "placeholder": "{{13}}"}, {"blank": " \u56fd\u5bb6\u89c4\u5b9a\u7684\u5176\u4ed6\u6761\u4ef6", "placeholder": "{{14}}"}, {"blank": "\u672c\u9879\u76ee\u662f\u5426\u5141\u8bb8\u8054\u5408\u4f53\u6295\u6807", "placeholder": "{{15}}"}, {"blank": "\u672c\u9879\u76ee\u662f\u5426\u63a5\u53d7\u4ee3\u7406\u5546\u6295\u6807", "placeholder": "{{16}}"}, {"blank": "\u62db\u6807\u6587\u4ef6\u83b7\u53d6\u65f6\u95f4\uff0c\u6309\u5e74\u6708\u65e5\u683c\u5f0f\u586b\u5199\u5f00\u59cb\u4e0e\u7ed3\u675f\u65e5\u671f", "placeholder": "{{17}}"}, {"blank": "\u62db\u6807\u6587\u4ef6\u8d2d\u4e70\u65f6\u95f4\uff0c\u6309\u5e74\u6708\u65e5", "placeholder": "{{18}}"}, {"blank": "\u6bcf\u65e5\u4e0a\u5348\u548c\u4e0b\u5348\u7684\u5177\u4f53\u65f6\u95f4", "placeholder": "{{19}}"}, {"blank": "\u62db\u6807\u6587\u4ef6\u5177\u4f53\u8d2d\u4e70\u5730\u70b9", "placeholder": "{{20}}"}, {"blank": "\u62db\u6807\u6587\u4ef6\u6bcf\u6807\u6bb5\u552e\u4ef7\u91d1\u989d", "placeholder": "{{21}}"}, {"blank": "\u6295\u6807\u6587\u4ef6\u9012\u4ea4\u622a\u6b62\u65f6\u95f4\uff0c\u6309\u5e74\u6708\u65e5\u65f6\u5206", "placeholder": "{{22}}"}, {"blank": "\u9012\u4ea4\u622a\u6b62\u65f6\u95f4\uff0c\u6309\u5e74\u6708\u65e5\u65f6\u5206", "placeholder": "{{23}}"}, {"blank": "\u5f00\u6807\u65f6\u95f4\uff0c\u6309 \u5e74\u6708\u65e5\u65f6\u5206", "placeholder": "{{24}}"}, {"blank": "\u7ebf\u4e0b\u62db\u6807\u7684\u5f00\u6807\u5730\u70b9", "placeholder": "{{25}}"}, {"blank": "\u76d1\u7763\u90e8\u95e8", "placeholder": "{{26}}"}, {"blank": "\u62db\u6807\u4eba\u540d\u79f0", "placeholder": "{{27}}"}, {"blank": "\u62db\u6807\u4eba\u8054\u7cfb\u4eba", "placeholder": "{{28}}"}, {"blank": "\u62db\u6807\u4eba\u7535\u8bdd", "placeholder": "{{29}}"}, {"blank": "\u62db\u6807\u4eba\u7535\u5b50\u90ae\u4ef6", "placeholder": "{{30}}"}, {"blank": "\u62db\u6807\u4ee3\u7406\u673a\u6784\u7535\u8bdd", "placeholder": "{{31}}"}, {"blank": "\u62db\u6807\u4ee3\u7406\u673a\u6784\u7535\u5b50\u90ae\u4ef6", "placeholder": "{{32}}"}, {"blank": "\u62db\u6807\u4eba\u6216\u5176\u62db\u6807\u4ee3\u7406\u673a\u6784\u4e3b\u8981\u8d1f\u8d23\u4eba(\u9879\u76ee\u8d1f\u8d23\u4eba)\u7684\u7b7e\u540d", "placeholder": "{{33}}"}, {"blank": "\u62db\u6807\u4eba\u6216\u5176\u62db\u6807\u4ee3\u7406\u673a\u6784\u7684\u76d6\u7ae0", "placeholder": "{{34}}"}]}', elapsed_time=62.6628787690006, total_tokens=6824241167, total_steps=76, finished_at='2024-12-30T05:32:19.413373'::timestamp WHERE workflow_runs.id = '0b7e3b88-c0e1-47cb-a773-574a45a4eaae'::UUID

✔️ Expected Behavior

update collectly

❌ Actual Behavior

integer out of range

@yuhua6379
Copy link
Author

image

@yuhua6379
Copy link
Author

@GareArc

@dosubot dosubot bot added the 🐞 bug Something isn't working label Dec 30, 2024
Copy link

dosubot bot commented Dec 30, 2024

To resolve the "integer out of range" error in the workflow_runs table when the total_tokens value exceeds the integer capacity, you need to change the column type from Integer to BigInteger. This will allow the column to store larger values. You can achieve this by creating a migration script using Alembic. Here's an example of how you can do it:

from alembic import op
import sqlalchemy as sa

def upgrade():
    with op.batch_alter_table('workflow_runs', schema=None) as batch_op:
        batch_op.alter_column('total_tokens',
                              existing_type=sa.Integer(),
                              type_=sa.BigInteger(),
                              existing_nullable=False,
                              server_default=sa.text('0'))

def downgrade():
    with op.batch_alter_table('workflow_runs', schema=None) as batch_op:
        batch_op.alter_column('total_tokens',
                              existing_type=sa.BigInteger(),
                              type_=sa.Integer(),
                              existing_nullable=False,
                              server_default=sa.text('0'))

This script will modify the total_tokens column to use BigInteger, which can handle larger values, thus resolving the error [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@yuhua6379
Copy link
Author

image
I change this to biginteger and work correctly. Please fix this soon. 🥰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants