Re: [GENERAL] [PERFORM] Arguments Pro/Contra Software Raid

2006-05-14 Thread Lincoln Yeoh

At 11:53 AM 5/12/2006 -0400, Tom Lane wrote:


Scott Ribe <[EMAIL PROTECTED]> writes:
>> My damn powerbook drive recently failed with very little warning

> It seems to me that S.M.A.R.T. reporting is a crock of shit. I've had ATA
> drives report everything OK while clearly in the final throes of death, 
just

> minutes before total failure.

FWIW, I replaced a powerbook's drive about two weeks ago myself, and its
SMART reporting didn't show a darn thing wrong either.  Fortunately, the
drive started acting noticeably weird (long pauses seemingly trying to
recalibrate itself) while still working well enough that I was able to
get everything copied off it.  I didn't wait for it to fail completely ;-)


Strange. With long pauses, usually you'd see stuff like "crc" errors in the 
logs, and you'd get some info from the SMART monitoring stuff.


I guess a lot of it depends on the drive model and manufacturer.

SMART reporting is better than nothing, and it's actually not too bad. It's 
just whether manufacturers implement it in useful ways or not.


I wouldn't trust the drive or manufacturer's judgement on when failure is 
imminent - the drive usually gathers statistics etc and these are typically 
readable with the SMART monitoring/reporting software, so you should check 
those stats and decide for yourself when failure is imminent.


For example: I'd suggest regarding any non-cable related CRC errors, or 
seek failures as "drive replacement time"- even if the drive or 
Manufacturer thinks you need to have tons in a row for "failure imminent".


I recommend "blacklisting" drives which don't notice anything before it is 
too late. e.g. even if it starts taking a long time to read a block, it 
reports no differences in the SMART stats.


Link.



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

  http://archives.postgresql.org


Re: [GENERAL] Mac Problem with Tunneling...

2006-05-14 Thread Tino Wildenhain
Jerry LeVan wrote:
> Hi,
> On my linux box I can issue the command
> 
> ssh -L :macjerry:5432 -l jerry macjerry
> 
> This will create a "tunnel" to connect to my
> mac named "macjerrry".
> 
> I can connect to databases on macjerry via psql
> by specifying port  on my linux box and other postgresql
> front ends.
> 
> How ever if I turn it around, and on the mac issue
> the command
> 
> ssh -L :linuxbox:5432 -l jerry linuxbox
> 
> Then I am not able to connect to the linux box
> via psql or any Gui front ends.
> 
> I get an error:
> 
> [EMAIL PROTECTED] ~]$ channel 3: open failed: administratively
> prohibited: open failed
> channel 3: open failed: administratively prohibited: open failed
> 
> No errors appear in the server log on the linux box.
> 
> I am new to ssh, have I overlooked something?

Well one slight mistake is maybe to use the hostname
in the forward. The forward is always calculated from
ssh-connection end point. And in your case it should be
in both cases: localhost - since you are connecting
to the box where the service runs.

This might or might not change anything but a connection
from localhost to localhost is always treated differently
by firewalls.

Also make sure: AllowTcpForwarding yes
is set in sshd_config

Regards
Tino

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


[GENERAL] problem with compiling with readline library

2006-05-14 Thread Sebastian Małyska
Hi allI have got a problem. I try to install postgresql ver.8.1.3. on the Debian (2.4.27-2-sparc64). I got message that readline does not found. So I downloaded readline 5.1 and instaled it. But I still can not install postgresql I recive the same message :( . I don't know what I am doing wrong. Maybe postgresql's config checkig unproper direction? So what can I do check it and change it? Direction of my readline is /usr/local/include/readline .
Thx for helpKindly sincerely Sebastian M


Re: [GENERAL] rules: evaluate inputs in advance

2006-05-14 Thread Martijn van Oosterhout
On Sun, May 14, 2006 at 08:01:39AM +0200, Markus Schiltknecht wrote:
> > What you probably want is a function that is given the row and then
> > executes the two statements on a per row basis. This has the effect you
> > want but gives up the major benefit of rules, wholesale query
> > restructuring like views which allows the executor to find better
> > plans. The executor can't see inside a trigger so it can't optimise.
> 
> Isn't that an argument for keeping rewrite rules instead of using
> something trigger like for updatable views? Wouldn't it be feasible to
> teach the executor how to handle multiple queries with some
> pre-evaluated input?

Well, I notice that the SQL standard defines something called WITH, so
what you want is something like:

WITH OLD AS ( SELECT blah )
DO
( UPDATE 
; DELETE  )

The standard doesn't allow you apply one WITH clause to two statements
but that is what you want. The implementation though would be, well,
difficult...

Have a nice day,
-- 
Martijn van Oosterhout  http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to 
> litigate.


signature.asc
Description: Digital signature


Re: [GENERAL] problem with compiling with readline library

2006-05-14 Thread Tino Wildenhain
Sebastian Ma?yska wrote:
> Hi all
> 
> I have got a problem. I try to install postgresql ver.8.1.3. on the
> Debian (2.4.27-2-sparc64). I got message that readline does not found.
> So I downloaded readline 5.1 and instaled it. But I still can not
> install postgresql I recive the same message :( . I don't know what I am
> doing wrong. Maybe postgresql's config checkig unproper direction? So
> what can I do check it and change it? Direction of my readline is
> /usr/local/include/readline .

compiling or installing? If you install,
via apt-get install postgresql-8.1, there is no "problem with
compiling" but rather the chance of a depency problem which you
better report to the debian staff (or the package maintainer).

If you really build from source, you need the respective -dev
package of the libs postgres needs. In your case, its

libreadline5-dev - GNU readline and history libraries, development files

since the header files are needed during the linking.

Regards
Tino

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


[GENERAL] Diferences between functions criated in pg 8.0.4 and criated in pg 7.4.8

2006-05-14 Thread Alejandro Michelin Salomon \( Adinet \)
Hi :

I criated some function in my pg 8.0.4, they function as spected.

But when i try tu criate this functions in my hosting that has pg 7.4.8, i
can not do.
I read documentation an i see some disferences.

This is one of original function that i try to criate :

CREATE OR REPLACE FUNCTION LEFT( sTexto CHARACTER VARYING, nPosFin INTEGER )
RETURNS "varchar" AS $$

BEGIN
IF sTexto IS NULL OR nPosFin IS NULL OR nPosFin <= 0 THEN
RETURN '';
ELSE
RETURN SUBSTR( sTexto, 1, nPosFin );
END IF;
END;
$$ LANGUAGE plpgsql
CALLED ON NULL INPUT
SECURITY INVOKER;

Left is not part of postgresql functions. I am migrating a system does runs
in mysql to postgresql.
To make easy i create some mysql functions in pg/plsql.

How i need change, to get this function runing in pg 7.4.8 ?

Thanks in advnace.

Alejandro Michelin Salomon
Porto Alegre
Brasil

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.6/339 - Release Date: 14/5/2006
 



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.6/339 - Release Date: 14/5/2006


---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [GENERAL] Diferences between functions criated in pg 8.0.4 and criated in pg 7.4.8

2006-05-14 Thread Martijn van Oosterhout
On Sun, May 14, 2006 at 10:10:44AM -0300, Alejandro Michelin Salomon ( Adinet ) 
wrote:
> Hi :
> 
> I criated some function in my pg 8.0.4, they function as spected.
> 
> But when i try tu criate this functions in my hosting that has pg 7.4.8, i
> can not do.
> I read documentation an i see some disferences.



> How i need change, to get this function runing in pg 7.4.8 ?

Well, since you havn't told us the error message it's hard to tell the
problem. At a guess though, 7.4 doesn't understand dollar-quoting.

Have a nice day,
-- 
Martijn van Oosterhout  http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to 
> litigate.


signature.asc
Description: Digital signature


Re: [GENERAL] Diferences between functions criated in pg 8.0.4 and criated in pg 7.4.8

2006-05-14 Thread Andreas Kretschmer
Alejandro Michelin Salomon ( Adinet ) <[EMAIL PROTECTED]> schrieb:
> I criated some function in my pg 8.0.4, they function as spected.
> 
> But when i try tu criate this functions in my hosting that has pg 7.4.8, i
> can not do.
> I read documentation an i see some disferences.
> 
> This is one of original function that i try to criate :
> 
> CREATE OR REPLACE FUNCTION LEFT( sTexto CHARACTER VARYING, nPosFin INTEGER )
> RETURNS "varchar" AS $$
   ^^
this works only since 8.0 or 8.1, i'm not sure, but not in 7.x.

You need "create or replace ... as '" and within the funktion '' for
single '. Please read the documentation for 7.x.


HTH, Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.  (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."(unknow)
Kaufbach, Saxony, Germany, Europe.  N 51.05082°, E 13.56889°

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


RES: [GENERAL] Diferences between functions criated in pg 8.0.4 and criated in pg 7.4.8

2006-05-14 Thread Alejandro Michelin Salomon \( Adinet \)
Martijn :

OK, y try to explain.

First, y im using phppgAdmin for do this operations, becous my systems are
all web based.
My developpement plataform is windows, and this is the reason of use pg
8.0.4.

1)  I change :

CREATE OR REPLACE FUNCTION LEFT( sTexto CHARACTER VARYING, nPosFin INTEGER )
for :
CREATE OR REPLACE FUNCTION LEFT( CHARACTER VARYING, INTEGER )

Becouse in the online documentation of pg 7.4 does not has other syntax for
parameters.

2) 

RETURNS "varchar" AS $$  --> Syntax error here.


I change the function to 

CREATE OR REPLACE FUNCTION LEFT( CHARACTER VARYING, INTEGER )
RETURNS "varchar" 
LANGUAGE plpgsql
CALLED ON NULL INPUT
SECURITY INVOKER
AS '
BEGIN
IF sTexto IS NULL OR nPosFin IS NULL OR nPosFin <= 0 THEN
RETURN '';
ELSE
RETURN SUBSTR( sTexto, 1, nPosFin );
END IF;
END;
';

At this point i have sourprice. The hosting say does no exist 'plpgsql'

This last syntax has error, but i can't find.

Can you help me ?

Alejandro MSG <[EMAIL PROTECTED]>
Porto Alegre
Brasil


-->-Mensagem original-
-->De: [EMAIL PROTECTED] 
-->[mailto:[EMAIL PROTECTED] Em nome de 
-->Martijn van Oosterhout
-->Enviada em: domingo, 14 de maio de 2006 10:38
-->Para: Alejandro Michelin Salomon ( Adinet )
-->Cc: Pgsql-General
-->Assunto: Re: [GENERAL] Diferences between functions criated 
-->in pg 8.0.4 and criated in pg 7.4.8
-->
-->
-->On Sun, May 14, 2006 at 10:10:44AM -0300, Alejandro Michelin 
-->Salomon ( Adinet ) wrote:
-->> Hi :
-->> 
-->> I criated some function in my pg 8.0.4, they function as spected.
-->> 
-->> But when i try tu criate this functions in my hosting that has pg 
-->> 7.4.8, i can not do. I read documentation an i see some 
-->disferences.
-->
-->
-->
-->> How i need change, to get this function runing in pg 7.4.8 ?
-->
-->Well, since you havn't told us the error message it's hard 
-->to tell the problem. At a guess though, 7.4 doesn't 
-->understand dollar-quoting.
-->
-->Have a nice day,
-->-- 
-->Martijn van Oosterhout  
-->http://svana.org/kleptog/
-->> From each according to his ability. To each according to 
-->his ability 
-->> to litigate.
-->
-->-- 
-->No virus found in this incoming message.
-->Checked by AVG Free Edition.
-->Version: 7.1.392 / Virus Database: 268.5.6/339 - Release 
-->Date: 14/5/2006
--> 
-->  
-->

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.6/339 - Release Date: 14/5/2006
 



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.6/339 - Release Date: 14/5/2006


---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: RES: [GENERAL] Diferences between functions criated in pg 8.0.4 and criated in pg 7.4.8

2006-05-14 Thread Adrian Klaver
The first thing to check is whether the hosting service has installed PL/pgsql 
as a language. If you have sufficient privileges you could try 'select 
lanname from pg_languages' to see if it is installed.
On Sunday 14 May 2006 07:08 am, Alejandro Michelin Salomon ( Adinet ) wrote:
> Martijn :
>
> OK, y try to explain.
>
> First, y im using phppgAdmin for do this operations, becous my systems are
> all web based.
> My developpement plataform is windows, and this is the reason of use pg
> 8.0.4.
>
> 1)  I change :
>
> CREATE OR REPLACE FUNCTION LEFT( sTexto CHARACTER VARYING, nPosFin INTEGER
> ) for :
> CREATE OR REPLACE FUNCTION LEFT( CHARACTER VARYING, INTEGER )
>
> Becouse in the online documentation of pg 7.4 does not has other syntax for
> parameters.
>
> 2)
>
> RETURNS "varchar" AS $$  --> Syntax error here.
>
>
> I change the function to
>
> CREATE OR REPLACE FUNCTION LEFT( CHARACTER VARYING, INTEGER )
> RETURNS "varchar"
> LANGUAGE plpgsql
> CALLED ON NULL INPUT
> SECURITY INVOKER
> AS '
> BEGIN
> IF sTexto IS NULL OR nPosFin IS NULL OR nPosFin <= 0 THEN
> RETURN '';
> ELSE
> RETURN SUBSTR( sTexto, 1, nPosFin );
> END IF;
> END;
> ';
>
> At this point i have sourprice. The hosting say does no exist 'plpgsql'
>
> This last syntax has error, but i can't find.
>
> Can you help me ?
>
> Alejandro MSG <[EMAIL PROTECTED]>
> Porto Alegre
> Brasil
>
>
> -->-Mensagem original-
> -->De: [EMAIL PROTECTED]
> -->[mailto:[EMAIL PROTECTED] Em nome de
> -->Martijn van Oosterhout
> -->Enviada em: domingo, 14 de maio de 2006 10:38
> -->Para: Alejandro Michelin Salomon ( Adinet )
> -->Cc: Pgsql-General
> -->Assunto: Re: [GENERAL] Diferences between functions criated
> -->in pg 8.0.4 and criated in pg 7.4.8
> -->
> -->
> -->On Sun, May 14, 2006 at 10:10:44AM -0300, Alejandro Michelin
> -->Salomon ( Adinet ) wrote:
> -->> Hi :
> -->>
> -->> I criated some function in my pg 8.0.4, they function as spected.
> -->>
> -->> But when i try tu criate this functions in my hosting that has pg
> -->> 7.4.8, i can not do. I read documentation an i see some
> -->disferences.
> -->
> -->
> -->
> -->> How i need change, to get this function runing in pg 7.4.8 ?
> -->
> -->Well, since you havn't told us the error message it's hard
> -->to tell the problem. At a guess though, 7.4 doesn't
> -->understand dollar-quoting.
> -->
> -->Have a nice day,
> -->--
> -->Martijn van Oosterhout   
> -->http://svana.org/kleptog/
> -->> From each according to his ability. To each according to
> -->his ability
> -->> to litigate.
> -->
> -->--
> -->No virus found in this incoming message.
> -->Checked by AVG Free Edition.
> -->Version: 7.1.392 / Virus Database: 268.5.6/339 - Release
> -->Date: 14/5/2006
> -->
> -->
> -->

-- 
Adrian Klaver   
[EMAIL PROTECTED]

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


RES: RES: [GENERAL] Diferences between functions criated in pg 8.0.4 and criated in pg 7.4.8

2006-05-14 Thread Alejandro Michelin Salomon \( Adinet \)
Adrian :

I make some changes, based in documentation that i find in the web, and i
have this error :

ERROR:  language "plpgsql" does not exist

Seems this guys does not put pg/plsql in the instalation.

I have a question, is not pg/plsql core part in postgresql?
If not is core funcionality, is not time to be pg/plsql part off the core.
Postgresql without pg/plsql instaled, is like a Oracle without pl/sql.

Thanks for help.

Alejandro MSG <[EMAIL PROTECTED]>
Porto Alegre
Brasil

-->-Mensagem original-
-->De: Adrian Klaver [mailto:[EMAIL PROTECTED] 
-->Enviada em: domingo, 14 de maio de 2006 11:50
-->Para: pgsql-general@postgresql.org
-->Cc: Alejandro Michelin Salomon ( Adinet ); 'Martijn van Oosterhout'
-->Assunto: Re: RES: [GENERAL] Diferences between functions 
-->criated in pg 8.0.4 and criated in pg 7.4.8
-->
-->
-->The first thing to check is whether the hosting service has 
-->installed PL/pgsql 
-->as a language. If you have sufficient privileges you could 
-->try 'select 
-->lanname from pg_languages' to see if it is installed.
-->On Sunday 14 May 2006 07:08 am, Alejandro Michelin Salomon ( 
-->Adinet ) wrote:
-->> Martijn :
-->>
-->> OK, y try to explain.
-->>
-->> First, y im using phppgAdmin for do this operations, 
-->becous my systems 
-->> are all web based. My developpement plataform is windows, 
-->and this is 
-->> the reason of use pg 8.0.4.
-->>
-->> 1)  I change :
-->>
-->> CREATE OR REPLACE FUNCTION LEFT( sTexto CHARACTER VARYING, nPosFin 
-->> INTEGER
-->> ) for :
-->> CREATE OR REPLACE FUNCTION LEFT( CHARACTER VARYING, INTEGER )
-->>
-->> Becouse in the online documentation of pg 7.4 does not has other 
-->> syntax for parameters.
-->>
-->> 2)
-->>
-->> RETURNS "varchar" AS $$  --> Syntax error here.
-->>
-->>
-->> I change the function to
-->>
-->> CREATE OR REPLACE FUNCTION LEFT( CHARACTER VARYING, 
-->INTEGER ) RETURNS 
-->> "varchar" LANGUAGE plpgsql
-->> CALLED ON NULL INPUT
-->> SECURITY INVOKER
-->> AS '
-->> BEGIN
-->> IF sTexto IS NULL OR nPosFin IS NULL OR nPosFin <= 0 THEN
-->> RETURN '';
-->> ELSE
-->> RETURN SUBSTR( sTexto, 1, nPosFin );
-->> END IF;
-->> END;
-->> ';
-->>
-->> At this point i have sourprice. The hosting say does no exist 
-->> 'plpgsql'
-->>
-->> This last syntax has error, but i can't find.
-->>
-->> Can you help me ?
-->>
-->> Alejandro MSG <[EMAIL PROTECTED]>
-->> Porto Alegre
-->> Brasil
-->>
-->>
-->> -->-Mensagem original-
-->> -->De: [EMAIL PROTECTED]
-->> -->[mailto:[EMAIL PROTECTED] Em nome de 
-->Martijn van 
-->> -->Oosterhout Enviada em: domingo, 14 de maio de 2006 10:38
-->> -->Para: Alejandro Michelin Salomon ( Adinet )
-->> -->Cc: Pgsql-General
-->> -->Assunto: Re: [GENERAL] Diferences between functions criated
-->> -->in pg 8.0.4 and criated in pg 7.4.8
-->> -->
-->> -->
-->> -->On Sun, May 14, 2006 at 10:10:44AM -0300, Alejandro Michelin 
-->> -->Salomon ( Adinet ) wrote:
-->> -->> Hi :
-->> -->>
-->> -->> I criated some function in my pg 8.0.4, they function 
-->as spected.
-->> -->>
-->> -->> But when i try tu criate this functions in my hosting 
-->that has pg 
-->> -->> 7.4.8, i can not do. I read documentation an i see some
-->> -->disferences.
-->> -->
-->> -->
-->> -->
-->> -->> How i need change, to get this function runing in pg 7.4.8 ?
-->> -->
-->> -->Well, since you havn't told us the error message it's 
-->hard to tell 
-->> -->the problem. At a guess though, 7.4 doesn't understand 
-->> -->dollar-quoting.
-->> -->
-->> -->Have a nice day,
-->> -->--
-->> -->Martijn van Oosterhout   
-->> -->http://svana.org/kleptog/
-->> -->> From each according to his ability. To each according to
-->> -->his ability
-->> -->> to litigate.
-->> -->
-->> -->--
-->> -->No virus found in this incoming message.
-->> -->Checked by AVG Free Edition.
-->> -->Version: 7.1.392 / Virus Database: 268.5.6/339 - Release
-->> -->Date: 14/5/2006
-->> -->
-->> -->
-->> -->
-->
-->-- 
-->Adrian Klaver
-->[EMAIL PROTECTED]
-->
-->
-->-- 
-->No virus found in this incoming message.
-->Checked by AVG Free Edition.
-->Version: 7.1.392 / Virus Database: 268.5.6/339 - Release 
-->Date: 14/5/2006
-->
-->
-->-- 
-->No virus found in this incoming message.
-->Checked by AVG Free Edition.
-->Version: 7.1.392 / Virus Database: 268.5.6/339 - Release 
-->Date: 14/5/2006
--> 
-->

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.6/339 - Release Date: 14/5/2006
 



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.6/339 - Release Date: 14/5/2006


---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[GENERAL] Cygwin psql with Windows native Postgres

2006-05-14 Thread Michael Artz
I thought I'd be clever and use the cygwin 'psql' client to connect to
the Windows native PostgreSQL 8.1.3 running on the same box, since the
the cygwin port feels more like home (keybindings).  Unfortunately, I
get the following message when connecting (after about a minute):

$ psql -h 127.0.0.1 -l
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

So it looks like psql is connecting just fine, but timing out.  I can't
find anything of interest in the logs, and pg_hba.conf seems to be set
up just fine.  The native cmd psql works fine, as well as pgAdmin.

Has anyone done this before with/without success?  Any ideas on what
else to check out?

Thanks
-Mike


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


Re: RES: RES: [GENERAL] Diferences between functions criated in pg 8.0.4 and criated in pg 7.4.8

2006-05-14 Thread Adrian Klaver
The full explanation can be found here-
http://www.postgresql.org/docs/7.4/interactive/xplang.html

The short answer is that the language is included but needs to be installed. 
This is left to the discretion of the database administrator.

On Sunday 14 May 2006 08:18 am, Alejandro Michelin Salomon ( Adinet ) wrote:
> Adrian :
>
> I make some changes, based in documentation that i find in the web, and i
> have this error :
>
> ERROR:  language "plpgsql" does not exist
>
> Seems this guys does not put pg/plsql in the instalation.
>
> I have a question, is not pg/plsql core part in postgresql?
> If not is core funcionality, is not time to be pg/plsql part off the core.
> Postgresql without pg/plsql instaled, is like a Oracle without pl/sql.
>
> Thanks for help.
>
> Alejandro MSG <[EMAIL PROTECTED]>
> Porto Alegre
> Brasil
>

-- 
Adrian Klaver   
[EMAIL PROTECTED]

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [GENERAL] Diferences between functions criated in pg 8.0.4 and criated in pg 7.4.8

2006-05-14 Thread Jaime Casanova

On 5/14/06, Alejandro Michelin Salomon ( Adinet ) <[EMAIL PROTECTED]> wrote:

Martijn :

OK, y try to explain.

First, y im using phppgAdmin for do this operations, becous my systems are
all web based.
My developpement plataform is windows, and this is the reason of use pg
8.0.4.

1)  I change :

CREATE OR REPLACE FUNCTION LEFT( sTexto CHARACTER VARYING, nPosFin INTEGER )
for :
CREATE OR REPLACE FUNCTION LEFT( CHARACTER VARYING, INTEGER )

Becouse in the online documentation of pg 7.4 does not has other syntax for
parameters.

2)

RETURNS "varchar" AS $$  --> Syntax error here.


I change the function to

CREATE OR REPLACE FUNCTION LEFT( CHARACTER VARYING, INTEGER )
RETURNS "varchar"
LANGUAGE plpgsql
CALLED ON NULL INPUT
SECURITY INVOKER
AS '
BEGIN
   IF sTexto IS NULL OR nPosFin IS NULL OR nPosFin <= 0 THEN
   RETURN '';
   ELSE
   RETURN SUBSTR( sTexto, 1, nPosFin );
   END IF;
END;
';

At this point i have sourprice. The hosting say does no exist 'plpgsql'



once you have the plpgsql created (seems rare, where did you do your
previous tests?), you have solve some other details...

1) parameters have no name so you have to use it with $(number_parameter)
ie:
IF $1 IS NULL OR $2 IS NULL OR $2 <= 0 THEN

or you can use an alias clause to give the parameters a name:

DECLARE
sTexto alias for $1;
nPosFin alias for $2;


2) also this RETURN ''; is wrong because it sees the first ' and think
is the end of the function you have to double type the quote each
time.
ie:
   RETURN ;   -- those are not 2 double quotes but 4 single quotes


--
Atentamente,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
  Richard Cook

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


Re: [GENERAL] rules: evaluate inputs in advance

2006-05-14 Thread Tom Lane
Martijn van Oosterhout  writes:
> Well, I notice that the SQL standard defines something called WITH, so
> what you want is something like:

> WITH OLD AS ( SELECT blah )
> DO
> ( UPDATE 
> ; DELETE  )

I think it'd be a mistake to assume that WITH would fix Markus'
complaint.  I haven't studied the spec in detail but I think that WITH
acts largely like a macro too.  It certainly doesn't have the behavior
of "evaluate this just once", as one of the prime uses for it is in
recursive query definition.

regards, tom lane

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [GENERAL] Cygwin psql with Windows native Postgres

2006-05-14 Thread Tom Lane
"Michael Artz" <[EMAIL PROTECTED]> writes:
> I thought I'd be clever and use the cygwin 'psql' client to connect to
> the Windows native PostgreSQL 8.1.3 running on the same box, since the
> the cygwin port feels more like home (keybindings).  Unfortunately, I
> get the following message when connecting (after about a minute):

> $ psql -h 127.0.0.1 -l
> psql: server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.

The postmaster log might have something enlightening ...

regards, tom lane

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


Re: [GENERAL] GUI Interface

2006-05-14 Thread Florian G. Pflug

Tino Wildenhain wrote:

Kenneth Downs schrieb:

Dave Page wrote:

 On my linux box, it also has the dubious honor of being the only
program I have ever seen that can lock X hard, with killing the X
server being the only rescue (if you call that a rescue).  It can
connect over networks, but on mine it always seems to hang after
an hour or so, and you have to kill it and restart it.   
That's a new one. Any other symptoms? Can you get a backtrace from a 
coredump?


The good news is I could not reproduce it.  But when it happens again 
I'll know who to notify.


As I recall, the problem would occur in the query analyzer.  If there 
was highlighted text in the top window, and you highlighted a row in 
the results, and then clicked into the upper window while dragging the 
mouse, it would freeze the X server.  It has happened much much less 
often lately, but it did happen just two days ago, and it always 
involves a click-drag situation.


Yes, that seems a gtk issue. You mark, then klick accidentaly into
the marked text (usually to change the mark area) and in the result
you are dragging the text to nowhere. pgadmin and X freezes in this
case. However you can login via another box and just kill pgadmin
to unfreeze. Maybe there is a problem with how drag & drop
is/isnt handled by the code? I have no idea.
It only happens in pgAdmin III, though, so it must be some strange 
interaction between wxWindows and GTK. I believe that the window manager

is part of the problem too, because I've used KDE (together with kwin)
for the last few years, and while it had this freezing-problem 
initially, it went away with some update. I believed that a wx or 
pgadmin update solved this, but now I'm using Gnome (together with 
metacity), and the problem is back... :-(


However, I figured out that if you press ALT- with  being the
shortcut for some menu _directly_ after the freeze, the menu opens, and
the mouse pointer is restored back to it's normal shape... It won't work
if you click around after X freezes - I guess pgadminIII has to still 
have the focus for this to work...


greetings, Florian Pflug


---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [GENERAL] GUI Interface

2006-05-14 Thread Kenneth Downs

Florian G. Pflug wrote:


Tino Wildenhain wrote:


Kenneth Downs schrieb:


Dave Page wrote:


 On my linux box, it also has the dubious honor of being the only
program I have ever seen that can lock X hard, with killing the X
server being the only rescue (if you call that a rescue).  It can
connect over networks, but on mine it always seems to hang after
an hour or so, and you have to kill it and restart it.   
That's a new one. Any other symptoms? Can you get a backtrace from 
a coredump?


The good news is I could not reproduce it.  But when it happens 
again I'll know who to notify.


As I recall, the problem would occur in the query analyzer.  If 
there was highlighted text in the top window, and you highlighted a 
row in the results, and then clicked into the upper window while 
dragging the mouse, it would freeze the X server.  It has happened 
much much less often lately, but it did happen just two days ago, 
and it always involves a click-drag situation.



Yes, that seems a gtk issue. You mark, then klick accidentaly into
the marked text (usually to change the mark area) and in the result
you are dragging the text to nowhere. pgadmin and X freezes in this
case. However you can login via another box and just kill pgadmin
to unfreeze. Maybe there is a problem with how drag & drop
is/isnt handled by the code? I have no idea.


It only happens in pgAdmin III, though, so it must be some strange 
interaction between wxWindows and GTK. I believe that the window manager

is part of the problem too, because I've used KDE (together with kwin)
for the last few years, and while it had this freezing-problem 
initially, it went away with some update. I believed that a wx or 
pgadmin update solved this, but now I'm using Gnome (together with 
metacity), and the problem is back... :-(


However, I figured out that if you press ALT- with  being the
shortcut for some menu _directly_ after the freeze, the menu opens, and


Wow this is good to know.

I'm also glad to know I'm not the only person this is happening to.
begin:vcard
fn:Kenneth  Downs
n:Downs;Kenneth 
email;internet:[EMAIL PROTECTED]
tel;work:631-689-7200
tel;fax:631-689-0527
tel;cell:631-379-0010
x-mozilla-html:FALSE
version:2.1
end:vcard


---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [GENERAL] Cygwin psql with Windows native Postgres

2006-05-14 Thread Michael Artz
> The postmaster log might have something enlightening ...

hmm, perhaps.  I had a couple of these messages in there:

postgresql-2006-05-14_105843.log:2006-05-14 11:01:34 LOG:  could not
receive data from client: No connection could be made because the
target machine actively refused it.

however I tried to connect again and didn't see an error in the logs,
so I'm thinking that it doesn't correspond to my problem.  I'm not that
familiar with windows, and apparently winpcap doesn't let me put a
listener up on the the windows equivalent of lo0, so I can't really see
what's going on.  Any other ideas?

Thanks
-Mike


---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [GENERAL] GUI Interface

2006-05-14 Thread Dave Page

-Original Message-
From: "Kenneth Downs"<[EMAIL PROTECTED]>
Sent: 14/05/06 21:31:15
To: "pgsql-general@postgresql.org"
Subject: Re: [GENERAL] GUI Interface

> Florian G. Pflug wrote:

> > However, I figured out that if you press ALT- with  being the
> > shortcut for some menu _directly_ after the freeze, the menu opens, and

> Wow this is good to know.

> I'm also glad to know I'm not the only person this is happening to.

Kenneth; what platform are you running on, and ehich window manager are you 
using?

Regards, Dave


-Unmodified Original Message-
Florian G. Pflug wrote:

> Tino Wildenhain wrote:
>
>> Kenneth Downs schrieb:
>>
>>> Dave Page wrote:
>>>
  On my linux box, it also has the dubious honor of being the only
 program I have ever seen that can lock X hard, with killing the X
 server being the only rescue (if you call that a rescue).  It can
 connect over networks, but on mine it always seems to hang after
 an hour or so, and you have to kill it and restart it.   
 That's a new one. Any other symptoms? Can you get a backtrace from 
 a coredump?

>>> The good news is I could not reproduce it.  But when it happens 
>>> again I'll know who to notify.
>>>
>>> As I recall, the problem would occur in the query analyzer.  If 
>>> there was highlighted text in the top window, and you highlighted a 
>>> row in the results, and then clicked into the upper window while 
>>> dragging the mouse, it would freeze the X server.  It has happened 
>>> much much less often lately, but it did happen just two days ago, 
>>> and it always involves a click-drag situation.
>>
>>
>> Yes, that seems a gtk issue. You mark, then klick accidentaly into
>> the marked text (usually to change the mark area) and in the result
>> you are dragging the text to nowhere. pgadmin and X freezes in this
>> case. However you can login via another box and just kill pgadmin
>> to unfreeze. Maybe there is a problem with how drag & drop
>> is/isnt handled by the code? I have no idea.
>
> It only happens in pgAdmin III, though, so it must be some strange 
> interaction between wxWindows and GTK. I believe that the window manager
> is part of the problem too, because I've used KDE (together with kwin)
> for the last few years, and while it had this freezing-problem 
> initially, it went away with some update. I believed that a wx or 
> pgadmin update solved this, but now I'm using Gnome (together with 
> metacity), and the problem is back... :-(
>
> However, I figured out that if you press ALT- with  being the
> shortcut for some menu _directly_ after the freeze, the menu opens, and

Wow this is good to know.

I'm also glad to know I'm not the only person this is happening to.

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [GENERAL] GUI Interface

2006-05-14 Thread Kenneth Downs




Dave Page wrote:

  
  
  
Wow this is good to know.

  
  
  
  
I'm also glad to know I'm not the only person this is happening to.

  
  
Kenneth; what platform are you running on, and ehich window manager are you using?

Regards, Dave


  


gentoo linux on an AMD.  here are some stats, if you tell me any other
packages you need versions for I can provide those.

kernel 2.6.8
KDE 3.3.2
gtk+ 2.4.14
pgadmin3 1.2.2

The window manager would be whatever the default for KDE is.


begin:vcard
fn:Kenneth  Downs
n:Downs;Kenneth 
email;internet:[EMAIL PROTECTED]
tel;work:631-689-7200
tel;fax:631-689-0527
tel;cell:631-379-0010
x-mozilla-html:FALSE
version:2.1
end:vcard


---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[GENERAL] parameter passing from java program

2006-05-14 Thread dfx



Dear 
Sirs,
 
I am spending about 
10 hours on little problem: to pass a parameter (text) to a PostgreSQL (v. 
8.1 on Win2000). The
relevant code 
is:
 
java 
side:
private 
CallableStatement cs;
cs = 
conn.prepareCall(INSERT_CONGRESSO);
cs.setString(1, 
itemCongresso.getCongresso()); //return a String
cs.execute();
...
public static final 
String INSERT_CONGRESSO = "{SELECT 
ins_congressoa(?)}"; 
 
PostreSQL 
side:
CREATE OR REPLACE 
FUNCTION ins_congressoa(congresso text)  RETURNS void 
AS$BODY$INSERT INTO "Congressi" ("Congresso") VALUES 
($1)$BODY$  LANGUAGE 'sql' VOLATILE;ALTER FUNCTION 
ins_congressoa(congresso text) OWNER TO postgres;
 
With Pgadmin the 
function work fine, but from java program does not. WHY?
 
Thank 
you.
 
Domenico