postgresql-9.1

I forgot the password I entered during postgres installation

半腔热情 提交于 2019-11-26 04:03:50
问题 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 new user with superuser privileges? I am new to Postgres and just installed it for the first time. I am trying to use it with Rails and I am running Mac OS X Lion. 回答1: find the file

Rails 3 - can't install pg gem

北慕城南 提交于 2019-11-26 02:41:25
问题 When I try to run bundle (bundle install), I all the time get Installing pg (0.13.2) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/ryan/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb checking for pg_config... no No pg_config... trying anyway. If building fails, please try again with --with-pg-config=/path/to/pg_config checking for libpq-fe.h... no Can\'t find the \'libpq-fe.h header *** extconf.rb failed *** Could not create

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

跟風遠走 提交于 2019-11-26 02:26:50
问题 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 an error, ERROR: column \"makerar.wmname\" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT cname,

Generating time series between two dates in PostgreSQL

别说谁变了你拦得住时间么 提交于 2019-11-26 00:54:26
问题 I have a query like this that nicely generates a series of dates between 2 given dates: select date \'2004-03-07\' + j - i as AllDate from generate_series(0, extract(doy from date \'2004-03-07\')::int - 1) as i, generate_series(0, extract(doy from date \'2004-08-16\')::int - 1) as j It generates 162 dates between 2004-03-07 and 2004-08-16 and this what I want. The problem with this code is that it wouldn\'t give the right answer when the two dates are from different years, for example when I