[SQL] could not connect to server

2006-10-13 Thread ivan marchesini
Dear Users,
I have this problem:
I'm running postgres 7.3 on a linux system...
I have started postmaster with -i option, but when I try to connect to
the server  from another computer I obtain:

psql: could not connect to server: Nessuna rotta verso l'host
Is the server running on host "IP." and accepting
TCP/IP connections on port 5432?

when I try to connect from the same computer running the postgres server
(using TCP/IP )
psql cave_prova -h IP -p 5432 -U aurora

the server answer correctly... and I can connect...
so I think the TCP/IP socket is working well!!!

can you suggest me some ideas for solving this problem???
thank you
Ivan


-- 
Ivan Marchesini
Department of Civil and Environmental Engineering
University of Perugia
Via G. Duranti 93/a 
06125
Perugia (Italy)
e-mail: [EMAIL PROTECTED]
[EMAIL PROTECTED]
tel: +39(0)755853760
fax: +39(0)755853756
jabber: [EMAIL PROTECTED]




---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [SQL] could not connect to server

2006-10-13 Thread A. Kretschmer
am  Fri, dem 13.10.2006, um  8:52:19 +0200 mailte ivan marchesini folgendes:
> Dear Users,
> I have this problem:
> I'm running postgres 7.3 on a linux system...

Uhm, a very old version...



> I have started postmaster with -i option, but when I try to connect to
> the server  from another computer I obtain:
> 
> psql: could not connect to server: Nessuna rotta verso l'host
> Is the server running on host "IP." and accepting
> TCP/IP connections on port 5432?
> 
> when I try to connect from the same computer running the postgres server
> (using TCP/IP )
> psql cave_prova -h IP -p 5432 -U aurora
> 
> the server answer correctly... and I can connect...
> so I think the TCP/IP socket is working well!!!
> 
> can you suggest me some ideas for solving this problem???
> thank you
> Ivan

Take a look in you ph_hba.conf - file and edit this properly. You need
an entry for the other host.

http://www.postgresql.org/docs/current/static/client-authentication.html



HTH, Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47215,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [SQL] could not connect to server

2006-10-13 Thread ivan marchesini
Dear Andreas,
this is my pg_hba.conf file:
__
# TYPE  DATABASEUSERIP-ADDRESSIP-MASK
METHOD

# IPv4-style local connections:
hostallall   127.0.0.1   255.255.255.255 trust
hostallall   "my_netaddres".0   255.255.255.0 trust
#hostall   

# IPv6-style local connections:
#hostall all ::1
:::::::trust

# Using sockets credentials for improved security. Not available
everywhere,
# but works on Linux, *BSD (and probably some others)

local  allall ident   sameuser
__


I hope is correct...
what do you think??

thank you!!









On ven, 2006-10-13 at 09:27 +0200, A. Kretschmer wrote:
> am  Fri, dem 13.10.2006, um  8:52:19 +0200 mailte ivan marchesini folgendes:
> > Dear Users,
> > I have this problem:
> > I'm running postgres 7.3 on a linux system...
> 
> Uhm, a very old version...
> 
> 
> 
> > I have started postmaster with -i option, but when I try to connect to
> > the server  from another computer I obtain:
> > 
> > psql: could not connect to server: Nessuna rotta verso l'host
> > Is the server running on host "IP." and accepting
> > TCP/IP connections on port 5432?
> > 
> > when I try to connect from the same computer running the postgres server
> > (using TCP/IP )
> > psql cave_prova -h IP -p 5432 -U aurora
> > 
> > the server answer correctly... and I can connect...
> > so I think the TCP/IP socket is working well!!!
> > 
> > can you suggest me some ideas for solving this problem???
> > thank you
> > Ivan
> 
> Take a look in you ph_hba.conf - file and edit this properly. You need
> an entry for the other host.
> 
> http://www.postgresql.org/docs/current/static/client-authentication.html
> 
> 
> 
> HTH, Andreas
-- 
Ivan Marchesini
Department of Civil and Environmental Engineering
University of Perugia
Via G. Duranti 93/a 
06125
Perugia (Italy)
e-mail: [EMAIL PROTECTED]
[EMAIL PROTECTED]
tel: +39(0)755853760
fax: +39(0)755853756
jabber: [EMAIL PROTECTED]




---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [SQL] could not connect to server

2006-10-13 Thread A. Kretschmer
am  Fri, dem 13.10.2006, um 11:01:59 +0200 mailte ivan marchesini folgendes:
> Dear Andreas,
> this is my pg_hba.conf file:
> __
> # TYPE  DATABASEUSERIP-ADDRESSIP-MASK
> METHOD
> 
> # IPv4-style local connections:
> hostallall   127.0.0.1   255.255.255.255 trust
> hostallall   "my_netaddres".0   255.255.255.0 trust
> #hostall   

with "my_netaddres" is a valid Ip-Net-Address?
Looks okay, but i have 8.1 and i have something like this:
(CIDR-notation)

hostall all 192.168.1.0/24  trust


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47215,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [SQL] deleting rows in specific order

2006-10-13 Thread Markus Schaber
Hi, Daniel,

Daniel Drotos wrote:

>> What is it that you're trying to achieve with the ordered delete? Maybe
>> there's a better way to solve your underlying problem.
> 
> I've a table which has a field for some info (number) and a date field
> (insertion date) and others.
> 
> After inserting new rows into this table, very old rows are going to be
> deleted. But value of deleted info should be remembered somehow, so
> there is a trigger on delete which keeps sum of the deleted info values
> in a separate table. This makes the application happy.
> 
> Trigger's algorithm is a little bit more dificult which I would be able
> to simplify if rows are deleted in date order.

Ah, I see.

I don't know exactly what you're doing here, but at least for a sum, the
order of summed values is not relevant.

And due to the transaction system, other applications won't see
inconsistent intermediate states, as the whole DELETE run and all
trigger calls are part of the same transaction.

> Now I'm doing it in a plpgsql function using a `for in select loop' to
> delete rows one by one.

I'm afraid that this is the only solution if you can't simplify the
trigger by other means.

HTH,
Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [SQL] could not connect to server

2006-10-13 Thread Tom Lane
ivan marchesini <[EMAIL PROTECTED]> writes:
> I have started postmaster with -i option, but when I try to connect to
> the server  from another computer I obtain:

> psql: could not connect to server: Nessuna rotta verso l'host
> Is the server running on host "IP." and accepting
> TCP/IP connections on port 5432?

Does that translate as "No route to host"?  If so, you've got basic
networking connectivity problems, unrelated to Postgres.  Check
networking parameters, cables firmly attached, etc.  When you can
ping the server from the client, then start trying psql ...

regards, tom lane

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [SQL] storing access rights in a postgres database

2006-10-13 Thread Aaron Bono
On 10/10/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
SELECT id, (SELECT allowed FROM rights WHERE user_id = 1 AND ( (firm_id = projects.firm_id AND project_id = projects.id ANDsubproject_id IS NULL)  OR (firm_id = 
projects.firm_id AND project_id IS NULL))ORDER BY firm_id, project_id, subproject_id, module_id, allowed DESC LIMIT 1) as allowedFROM projects;The problem is in the 'LIMIT 1' clause - that's the reason I can't write that as
a join.Does someone else has an idea how to solve this? If needed I can send morecomplex examples and some testing data, explain plans, etc.I've been thinking about some 'intermediate table' with results of the
subselect, updated by a set of triggers, but maybe there's some bettersolution.I think your problem is NOT the LIMIT, it is the fact that you are putting a select inside the select block (your correlated subquery).  You should try left outer joins instead:
SELECT    projects.id,    rights.allowedFROM projectsLEFT OUTER JOIN rights ON (    (    rights.firm_id = projects.firm_id    AND rights.project_id
 = projects.id    AND rights.subproject_id IS NULL    ) OR (    rights.firm_id = projects.firm_id    AND rights.project_id IS NULL    ))GROUP BY

    projects.id,
    rights.allowedUsing correlated subqueries is really bad (IMHO) because it causes your query to perform a select for each row returned.  I have never seen a correlated subquery that cannot be refactored into a join (this is a challenge for any of you who disagree - I would love to see a reason to use a correlated subquery).
You can get more information about correlated subqueries and performance at http://www.bcarter.com/sap29.htm .Also, I would consider putting a conditional unique constraint to enforce your rule on which fields must be null/not null to help preserve your data integrity.
Hope this helps!-- ==   Aaron Bono   Aranya Software Technologies, Inc.   http://www.aranya.com
   http://codeelixir.com==