hezean / sustc

Template for project 2 of SUSTech Principles of Database Systems (CS307 / CS213), 23 fall semester.
http://172.18.34.154
MIT License
22 stars 9 forks source link

Database connect failed #67

Closed Moxin12212810 closed 8 months ago

Moxin12212810 commented 9 months ago

Describe your question

I have created a common account and I've given it access to the database. And I also test it, it works in datagrip. But in idea, bootrun and benchmark both report this error when I was trying to test my code like "db import" or just "db sum 1 2". UGEU1$ $_NY6W42J0%Y~LYQ 51Y}5LWP%768(1}XE 850CF

I have updated all code about UTF-8 and I guarantee the information in application.yml is correct.

WhatWEat commented 9 months ago

Try logging in with a non-postgres account.

Moxin12212810 commented 9 months ago

What is a non-postgres account mean? Is that mean a account which is not a super account? But what I used in the picture is not a super account. You can see the Username is wyf, a common account.

sses7757 commented 8 months ago

@Moxin12212810 Since your error message is not properly decoded, I tried creating a non-superuser and have error of permission denied. My error is caused by the table truncation commands. Generally, since all the tables shall be removed at the beginning of the benchmark, you are required to provide a user with enough privileges, and that user must be able to login.

Moxin12212810 commented 8 months ago

@sses7757 I have given these permissions to wyf accounts using postgresaccounts:

grant connect on database sustc to wyf;
grant usage on schema public to wyf;
grant select, insert, update, delete, truncate on all tables in schema public to wyf;

Aren't these enough?

sses7757 commented 8 months ago

@Moxin12212810 What is your role creation statement? Did you create your role with LOGIN?

Moxin12212810 commented 8 months ago

@sses7757
When I was creating wyf account and giving it those permissions, the postgresaccount is logged in. And after that I also logged wyf account to test its permissions. There's no wrong and the permissions can work.

Moxin12212810 commented 8 months ago

@sses7757 Sorry, there's something wrong. I can't insert value into the table. But why this would happen? I'm sure that I gave the insert permission to wyfaccount by the superuser postgres 8OH30X(OS{MSGBF8YX%NGHM

sses7757 commented 8 months ago

@Moxin12212810 You can try removing and recreating your user. If that still does not work, I think that you may consult TA or SA at lab class for help.

Moxin12212810 commented 8 months ago

@sses7757 I have found the source of this error. Because I use serial id in some tables, so those table need an additionalseq permission. I give the non-superuser this permission and it can insert now. But in idea, I still have the same problem. I just execute db sum 1 2 and it reports the same error. In all, I don't think it's the permissions, it's the fact that I'm not connected to the database. P A@YTX)HWV$W`EK67@UYVY p.s. I did restart the bootrun so it can update the changes.

sses7757 commented 8 months ago

@Moxin12212810 Is this problem solved? If not, please change to correct encoding and print the full satcktrace.

Moxin12212810 commented 8 months ago

This problem is not solved, but I meet new problem now and I can even not build gradle now. I'm nearly crazy now.

}@)%3RE3)C6D_TG4M B{` A

I can not debug my code and it is the worst thing in project. And my ddl is this Thursday. I'm helpless now.