shared_buffers
in your postgresql.conf
, and get an error similar to this:IpcMemoryCreate: shmget(key=5432001, size=266371072, 03600) failed: Invalid argument This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter.You should increase your the
shmmax
parameters using tips in the Unix administration quickies.% createlang plpgsql template1
alter table pfo_survey_response_2006 add column section text
% pg_dump databasename > db.out
pg_hba.conf
, you can connect to the database, logged in as an ordinary person, by doing
% psql -U nsadmin opeancs
% createdb database-name
psql=# create user bork with password 'bork';
You can also do this for a passwordless user:
% crateuser bork
psql=# select to_timestamp('10:45am', 'HH12:MIam')::timetz::time; to_timestamp -------------- 10:45:00 (1 row)
limit
" statement:
select stuff from some_table where stuff.blah > 12 limit 5
% psql database-name user-name
% psql -h tower borkdb nettest
% pg_ctl -D /usr/local/pgsql/data -l /tmp/pgsql.log start
insert into blah (id, stuff) values (nextval('sequence_name'), 'stuff');
% psql -d databasename -f db.out
% psql -l
random()
function.select stuff.src, stuff.width, stuff.height from (select src, width, height, random() from bw_eyes order by 4) stuff limit 1This selects a random row from
bw_eyes
and returns the interesting data from it. This query is used on the quickies pages to randomly select an image of eyes staring back.select current_timestamp()::date - entry_date::date as days_old from kb_nuggets;
wplug-oacs=# \pset pager
Pager usage is off.
select blah from whatever where date-column > (current_timestamp - 21)
to get all the blahs from whatever in the last 21 days. This doesn't work in newer versions of Postgresql. Instead, you need to use a time interval:select to_char (whenx, 'fmDD fmMonth YYYY') as pretty_when, text from blog where whenx > (current_timestamp - interval '21 days') order by whenx desc