Change type of varchar field to integer: “cannot be cast automatically to type integer”

I have a small table and a certain field contains the type “character varying“. I’m trying to change it to “Integer” but it gives an error that casting is not possible. Is there a way around this or should I just create another table and bring the records into it using a query. The field … Read more

I forgot the password I entered during postgres installation

I either forgot or mistyped (during the installation) the password to the default user of Postgres. I can’t seem to be able to run it and I get the following error: psql: FATAL: password authentication failed for user “hisham” hisham-agil: hisham$ psql Is there anyway to reset the password or how do I create a … Read more

must appear in the GROUP BY clause or be used in an aggregate function

I have a table that looks like this caller ‘makerar’ cname | wmname | avg ——–+————-+———————— canada | zoro | 2.0000000000000000 spain | luffy | 1.00000000000000000000 spain | usopp | 5.0000000000000000 And I want to select the maximum avg for each cname. SELECT cname, wmname, MAX(avg) FROM makerar GROUP BY cname; but I will get … Read more