[GENERAL] remote connection refused

2012-11-19 Thread Yvon Thoraval
I'd like to have a checklist upon what to do, what to investigate, when an external connection is refused. if i connect by : psql -h localhost -p 5432 -U yt mydb it works as usual however even locally but using the LAN address : psql -h 192.168.0.20 -p 5432 -U yt mydb i got a : psql: could

Re: [GENERAL] remote connection refused

2012-11-19 Thread Yvon Thoraval
YES fine, thanks a lot ! it was left to default 'locahost'... 2012/11/19 Devrim GÜNDÜZ dev...@gunduz.org Hi, On Mon, 2012-11-19 at 13:08 +0100, Yvon Thoraval wrote: in such a situation what is your checklist in order to find what I've missed ? What is listen_addresses

[GENERAL] creating a function returning FALSE on NULL input ?

2012-11-06 Thread Yvon Thoraval
I'd like to create a function : returning true if the length of the text arg is greater than 0 ; false otherwise ; and also returning false when arg is NULL, then i wrote : CREATE FUNCTION has_infos(text) RETURNS boolean AS 'select character_length($1) 0;' LANGUAGE SQL IMMUTABLE RETURNS FALSE

Re: [GENERAL] creating a function returning FALSE on NULL input ?

2012-11-06 Thread Yvon Thoraval
; recettes$ END IF ; recettes$ END recettes$ $BODY$ recettes- LANGUAGE 'plpgsql' ; CREATE FUNCTION I've verified, it works on NULL input... 2012/11/7 David Johnston pol...@yahoo.com On Nov 7, 2012, at 0:33, Yvon Thoraval yvon.thora...@gmail.com wrote: I'd like to create a function : returning

Re: [GENERAL] creating a function returning FALSE on NULL input ?

2012-11-06 Thread Yvon Thoraval
Fine, thanks it's shorter than mine and works too. I'll adopt it )) 2012/11/7 Alban Hertroys haram...@gmail.com On 7 Nov 2012, at 6:33, Yvon Thoraval wrote: CREATE FUNCTION has_infos(text) RETURNS boolean AS 'select character_length($1) 0;' LANGUAGE SQL IMMUTABLE RETURNS FALSE ON NULL

[GENERAL] PostgreSQL and IPV6

2012-11-03 Thread Yvon Thoraval
I'm using to computers : - a laptop under Xubuntu 12.04 with PostgreSQL 9.1 - a desktop under Mac OS X Mountain Lion with PostgreSQL 9.2 After the switch to Mountain Lion, i had a small prob connecting to a database on my laptop. Usually when, from the laptop, i connect to the deskop which arn't

Re: [GENERAL] PostgreSQL and IPV6

2012-11-03 Thread Yvon Thoraval
at every WiFi connection/deconnection... 2012/11/3 Martijn van Oosterhout klep...@svana.org On Sat, Nov 03, 2012 at 09:11:51AM +0100, Yvon Thoraval wrote: I'm using to computers : - a laptop under Xubuntu 12.04 with PostgreSQL 9.1 - a desktop under Mac OS X Mountain Lion with PostgreSQL 9.2

Re: [GENERAL] [Mac OS X Mountain Lion] FATAL: could not create shared memory segment: Cannot allocate memory

2012-10-08 Thread Yvon Thoraval
2012/10/8 Ralf Schuchardt r...@gmx.de Using sysctl to set the shm* values has consistently worked for us in the last years ... probably i missed that point because my last install of postgres was on ubuntu... Mountain Lion comes with it's own version of PostgreSQL. The included psql

[GENERAL] [Mac OS X Mountain Lion] FATAL: could not create shared memory segment: Cannot allocate memory

2012-10-07 Thread Yvon Thoraval
I've just installed PostgreSQL, using brew, on Mac OS Mountain Lion. The server doesn't start and the log file shows : $ cat /usr/local/var/postgres/server.log FATAL: could not create shared memory segment: Cannot allocate memory DETAIL: Failed system call was shmget(key=5432002, size=3809280,

Re: [GENERAL] [Mac OS X Mountain Lion] FATAL: could not create shared memory segment: Cannot allocate memory

2012-10-07 Thread Yvon Thoraval
2012/10/7 Scott Marlowe scott.marl...@gmail.com http://www.postgresql.org/docs/9.2/static/kernel-resources.html OK, fine thanks to both. I've found a page dealing with that prob : Fixing the postgresql initdb fatal shared memory error on

Re: [GENERAL] [Mac OS X Mountain Lion] FATAL: could not create shared memory segment: Cannot allocate memory

2012-10-07 Thread Yvon Thoraval
2012/10/7 Scott Marlowe scott.marl...@gmail.com 'd have posted more, but 1: I know just enough about MacOS to be dangerous and 2: MacOS is known for changing how shared memory works from one minor patch to another so.. 3: Any page on making work will be dependent on the exact MacOS version

Re: [GENERAL] On Ubuntu 12.04 i do have two psql one of those isn't working

2012-09-18 Thread Yvon Thoraval
2012/9/18 Raymond O'Donnell r...@iol.ie On 18/09/2012 16:10, Yvon Thoraval wrote: I've found the prob. In my postgresql.conf file the default port is setup to 5433 instead of 5432 as previously... OK - you probably had two versions of PG installed at some point - when you install

Re: [GENERAL] On Ubuntu 12.04 i do have two psql one of those isn't working

2012-09-18 Thread Yvon Thoraval
I've found the prob. In my postgresql.conf file the default port is setup to 5433 instead of 5432 as previously... sorry for the noise.

[GENERAL] On Ubuntu 12.04 i do have two psql one of those isn't working

2012-09-17 Thread Yvon Thoraval
I'm testing my second PostgreSQL install on Xunutu 12.04 after a disk crash. Everything went well using command line where i was able, after config and setup, to log into a db using : $ psql IPV4 or IPV6 of the server -U yt -d yt_tests Then i wanted to test postgres thru php where i got Http

Re: [GENERAL] SQLSTATE[08006] [7] server closed the connection unexpectedly

2012-09-17 Thread Yvon Thoraval
2012/9/17 Albe Laurenz laurenz.a...@wien.gv.at Yvon Thoraval wrote: You may want to set log_statement='all' in postgresql.conf i did this change , restart PostgreSQL and test again, with the same error, however postgres log didn't report any error, as far as i understand the log

Re: [GENERAL] On Ubuntu 12.04 i do have two psql one of those isn't working

2012-09-17 Thread Yvon Thoraval
2012/9/17 Raymond O'Donnell r...@iol.ie The first isn't a real psql - it's a symlink to pg_wrapper, which is how Debian and Ubuntu allow you to run different Postgres versions and clusters on the same machine. You call the client program (psql, pg_dump, etc) you want as usual, but pass it

[GENERAL] SQLSTATE[08006] [7] server closed the connection unexpectedly

2012-09-14 Thread Yvon Thoraval
I do have a strange probleme when connecting to a database thru php using PDO. When connecting to the php script thru a browser i get the following error : HTTP 500 (Internal Server Error) Not really informative, then i've tried the php script thru Command Line where i get : yt@D620

Re: [GENERAL] SQLSTATE[08006] [7] server closed the connection unexpectedly

2012-09-14 Thread Yvon Thoraval
2012/9/14 Albe Laurenz laurenz.a...@wien.gv.at Is this repeatable? YES, may be i didn't mention that about the same config on another computer running mac OS X, works very well with same php script. Also this php script was working 2 months ago... i suspect something had changed on Xubuntu

Re: [GENERAL] SQLSTATE[08006] [7] server closed the connection unexpectedly

2012-09-14 Thread Yvon Thoraval
2012/9/14 Albe Laurenz laurenz.a...@wien.gv.at Yvon Thoraval wrote: You may want to set log_statement='all' in postgresql.conf i did this change , restart PostgreSQL and test again, with the same error, however postgres log didn't report any error, as far as i understand the log : 2012-09-14

Re: [GENERAL] recovering databases

2012-09-06 Thread Yvon Thoraval
2012/9/4 Albe Laurenz laurenz.a...@wien.gv.at Yvon Thoraval wrote: on my computer I had a disk probleme, then i had to reinstall the system (Xubuntu 12.04). I've backuped some parts of the disk, namely /etc, /var and /home. I wonder if I'm able to recover my past databases in the /var

[GENERAL] recovering databases

2012-09-04 Thread Yvon Thoraval
on my computer I had a disk probleme, then i had to reinstall the system (Xubuntu 12.04). I've backuped some parts of the disk, namely /etc, /var and /home. I wonder if I'm able to recover my past databases in the /var/lib/postgresql/9.1/ backup. If yes, how ? -- Yvon

[GENERAL] problem with serial

2012-04-19 Thread Yvon Thoraval
i do have a serial named 'rowid' it is of SERIAL PRIMARY KEY in a table 'items'. if i delete some of the rows i can't anymore insert afterwards. even if i rearrange de sequence by : SELECT MAX(rowid) FROM items;; SELECT last_value FROM items_rowid_seq;; then if last_value is lower than

Re: [GENERAL] problem with serial

2012-04-19 Thread Yvon Thoraval
2012/4/19 Chris Angelico ros...@gmail.com As a side point, I would recommend against doing this. Once you've used a rowid, it's not worth reusing it. You'll save yourself some headaches down the track if you simply ignore those odd gaps (ditto the gaps that result from rolled-back

Re: [GENERAL] problem with serial

2012-04-19 Thread Yvon Thoraval
2012/4/19 Chris Angelico ros...@gmail.com If all your inserts make use of the sequence, and you never alter the sequence, then this should never happen (unless, that is, 34 other inserts happened between when you inserted and when you checked the max). Be extremely careful of selecting

Re: [GENERAL] problem with serial

2012-04-19 Thread Yvon Thoraval
2012/4/19 Chris Angelico ros...@gmail.com On Fri, Apr 20, 2012 at 1:20 AM, Adrian Klaver adrian.kla...@gmail.com wrote: Am CCing list so more eyes can see this and because I don't use PHP. On 04/19/2012 07:59 AM, Yvon Thoraval wrote: Fatal error: Call to a member function fetch

Re: [GENERAL] problem with serial

2012-04-19 Thread Yvon Thoraval
2012/4/19 Chris Angelico ros...@gmail.com No; ditch them. I mean no offense to you personally, but these functions are not worth keeping. Every SQL API includes a function for quoting something as a literal string. With PDO, it's this one: http://www.php.net/manual/en/pdo.quote.php I

Re: [GENERAL] problem with serial

2012-04-19 Thread Yvon Thoraval
2012/4/19 Raymond O'Donnell r...@iol.ie Or better still - and easier - use parametrised queries. Right it is easier something like : $sql = categories (idx, ctime, mtime, name) VALUES ( :idx, :ctime, :mtime, :name);; $prep = $db-prepare($sql); $prep-execute( array(':idx' = $_GET['idx'],

Re: [GENERAL] problem with serial

2012-04-19 Thread Yvon Thoraval
2012/4/19 Raymond O'Donnell r...@iol.ie Yep - no need to worry about quoting if you use parameters - it's all done for you. It's also MUCH safer, as it makes SQL injection attacks much harder (if not impossible). Ray. fine, thanks ! -- Yvon

[GENERAL] Mac OS X Lion how to connect to remote server ?

2012-04-02 Thread Yvon Thoraval
I've installed PostgreSQL using one click installer on Mac OS X Lion. I'd like to query this server from the net. How to allow specific IPV6 addresses to connect to the databases 'addressbook', 'cli', 'landp' and 'landp_public' ? I've tested a simple solution using ssh port forwarding : $ ssh

[GENERAL] unaccent install howto ?

2012-03-20 Thread Yvon Thoraval
New to PostgreSQL, I'd like to install a dictionnary unaccent.rules and needs an howto. I do have to install that on Ubuntu 11.10 and Mac OS X latest. -- Yvon