[GENERAL] QueryBuffer 20K exceeded - still...

1999-01-18 Thread Silvio Emanuel Barbosa de Macedo


Hi!
I'm still dealing with "QueryBuffer exceeded, core dump..".

I've tried using
psql -e < xx.sql
psql -f xx.sql

as Bob Dusek suggested...

or inside psql with \i xx.sql.

I've broken the sql script in two... after a few lines of the second part,
the same error... should I download again and recompile , or others have
the same problem ?

I've scanned the mailing lists, and this problem seems to have happened
before - although no clear solution !


What should I do ?


System Configuration

  Operating System   : linux 2.0.36 (elf) Redhat 5.0+5.2 recompiled kernel

  PostgreSQL version : 6.4.1(corrected;=6.4.2)<-maybe the problem is here?

  Compiler used  : gcc 2.7.2.3

Hardware:
-
P133;64RAM;3G
Linux pluto 2.0.36 #1 Tue Oct 13 22:17:11 EDT 1998 i586 unknown


rpm -q glibc:
glibc-2.0.7-29


Versions of other tools:

GNU Make version 3.76.1
flex version 2.5.4




After many inserts... I've got this message:

query buffer max length of 2 exceeded
query line ignored

and then, a few inserts later, because the scritp went on...
PQsendQuery() -- query is too long.  Maximum length is 8191
query buffer max length of 2 exceeded
query line ignored
Segmentation fault (core dumped)



Thank you in advance!

,
`
Silvio Emanuel Nunes Barbosa de Macedo
mailto:[EMAIL PROTECTED]

INESC - Porto - Grupo CAV
Pc da Republica, 93 R/C   Tel:351 2 209 42 21
4000 PORTO  PORTUGAL  Fax:351 2 208 41 72











Re: Was...[GENERAL] Checkboxes on MSAccess and PostgreSQL

1999-01-18 Thread Robert Chalmers

Hi,
I'm pretty new to postgresql, but am reasonably familiar with MSAccess, and I
see here that Valerio can export tables from Access to pgsql. How is this done?
And using forms from Access related to pgsql databases?
This could be invaluable.  While I'm at it, does anyone know where there might
be some sample code for a shopping cart using pgsql as the database and php3?

Thanks for any info, especialy on getting msaccess and postgresql working
together.

Robert

Valerio Santinelli wrote:

> First of all.. thanks to everybody for helping me out witht the
> "sequence" stuff. :)
>
> I've got another questions for you dudes.  When using a CheckBox in a
> Form written in MSAccess that's related to a table in a
> PostgreSQL database, if I simply turn its status from ON to OFF it works
> fine, while if i'm doing the opposite it won't work.
>
> I noticed that when exporting the table from MSAccess to PostgreSQL the
> "yes/no" fields all became char(1) and not boolean.. maybe this could be
> the problem.
>
> I also noticed from the logs that when updating the status from ON to
> OFF the UPDATE goes out with something like field_name='0'
> I'm not sure it should use the "'" since it's more like a numerical, no
> ?
>
> Thanks again,
>
> Valerio Santinelli
> [EMAIL PROTECTED]

--
http://www.chalmers.com.au. Publications From China in 24 different languages.
English, French, German, Russian, Arabic, Spanish, Chinese, Burmese, Bengali,
Hindi, Indonesian, Italian, Japanese, Korean, Portuguese, Persian, Swahili,
Sinhalese, Thai, Tamil, Urdu, Vietnamese. China Books for CIBTC, Beijing.





[GENERAL] Checkboxes on MSAccess and PostgreSQL

1999-01-18 Thread Valerio Santinelli

First of all.. thanks to everybody for helping me out witht the
"sequence" stuff. :)

I've got another questions for you dudes.  When using a CheckBox in a
Form written in MSAccess that's related to a table in a
PostgreSQL database, if I simply turn its status from ON to OFF it works
fine, while if i'm doing the opposite it won't work.

I noticed that when exporting the table from MSAccess to PostgreSQL the
"yes/no" fields all became char(1) and not boolean.. maybe this could be
the problem.

I also noticed from the logs that when updating the status from ON to
OFF the UPDATE goes out with something like field_name='0'
I'm not sure it should use the "'" since it's more like a numerical, no
?

Thanks again,

Valerio Santinelli
[EMAIL PROTECTED]




[GENERAL] On the int8 type support

1999-01-18 Thread Memphisto

I wonder if it's thorougly tested or not. I've got a 6.3.2 version what's
the matter in case of 6.4?


Sebestyén Zoltán <[EMAIL PROTECTED]>I'm believing that the Holy Spirit is
gonna allow the hand, and the foot, and
MAKE INSTALL NOT WARthe mouth, just to begin to speak, and
to minister, and to heal coordinated by
the head.

I use UNIX because reboots are for hardware upgrades.

-- Eagerly waiting for FreeBSD 2.2.8 --




Re: [GENERAL] Representation of big integer numbers.

1999-01-18 Thread Jose' Soares

Memphisto wrote:
> 
> Hi,
> 
>  Is there a way to display big integer numbers splitted by periods in
> PostgreSQL queries?
> 
> Example: 123.456.789 instead of 123456789 .
> 
> Thanks in advance

You can create a function to format numbers.

See attached example.

-Jose'-

-- la funzione dec(float) ritorna la parte decimale come un intero
-- la limitazione e' che ha solo 3 cifre arrotondate 000-999
-- purtroppo la differenza tra un float e dtrunc(float) non funziona a
-- dovere, quindi ho usato la funzione date_parte('millisecond',float)
-- che tratta la parte decimale di un float come milisecondi.

drop function dec(float);
create function dec(float) returns text as
'
declare
txt text;
begin
--get decimal part...
txt:= dround(datetime_part(''millisecond'',$1));
if textlen(txt) = 2 then
txt:= ''0'' || txt;
end if;
if textlen(txt) = 1 then
txt:= ''00'' || txt;
end if;
return txt;
end;
' language 'plpgsql';

-- funzioni per la formattazione di interi e float

drop function format(float4,text);
create function format(float4,text) returns text as
'
begin
return format(float8($1),$2);
end;
' language 'plpgsql';
drop function format(float8,text);
create function format(float8,text) returns text as
'declare
fbak text;
vbak int8;
out text;
fout text;
lh text;
res1 int8;
res float8;
i int2;
df int2;
sval text;
begin
vbak:= dtrunc($1);
fbak:= $2;
res:=$1;
if $1 < 0 then
res := -(res);
else
res := res;
end if;
   
df:= textlen(fbak);
i:= textpos(fbak,'','');
if i > 0 then
fbak:= substr(fbak,1,i - 1);
end if;
lh:=dec(res);
fout:= format(vbak,fbak);
if i = 0 then
return fout;
end if;
out:= fout || ('','');
out:= out || (substr(lh || '''',1,df - i));
return out;
end;
' language 'plpgsql';


drop function format(int8,text);
create function format(int8,text) returns text as
'declare
fbak text;
vbak int8;
out text;
sign int2;
num char(1);
car char(1);
car1 char(1);
car0 char(1);
lf int2;
bf int2;
lv int2;
sval text;
begin
vbak := $1;
fbak := $2;


if vbak < 0 then
sign := 1;
vbak := -(vbak);
else
sign := 0;
end if;

lf := textlen(fbak);
bf := lf;
sval := vbak;
lv := textlen(sval);

if lv > lf then
raise exception ''the value % is greater than %'',$1,$2;
end if;

while (lv>0 or lf>0) loop
car:= substr(fbak,lf,1);
car0:= substr(fbak,lf+1,1);
car1:= substr(fbak,lf - 1,1);

if lv > 0 then
if lf=0 then
raise exception ''The value % is greater than 
%'',$1,$2;
end if;
if car = ''#'' or car = ''&'' then
num := substr(sval,lv,1);
out := substr(fbak,1,lf - 1) || num;
if bf > lf then
fbak := out ||  substr(fbak,lf+1);
else
fbak := out;
end if;
lf := lf - 1;
lv := lv - 1;
else
lf := lf - 1;
end if;
else
if sign = 1 then
sign :=  2;
fbak := substr(fbak,1,lf - 1) || (''-'' || 
substr(fbak,lf + 1));
else
if sign = 2 or car <> ''&'' then
if car0 = ''-'' or car0 = '' '' then
fbak := substr(fbak,1,lf - 1) || ('' 
'' || substr(fbak,lf + 1));
else
if car1 = ''#'' and (car <> ''#'' and 
car <> ''&'') then
fbak := substr(fbak,1,lf - 1) 
|| ('' '' || substr(fbak,lf + 1));
else
if car1 = ''#'' then
fbak := 
substr(fbak,1,lf - 1) || ('' '' || substr(fbak,lf + 1));
end if;
en

Re: [GENERAL] How to increment by hand a sequence number.

1999-01-18 Thread Blashko Alexander



On Mon, 18 Jan 1999, Valerio Santinelli wrote:

> I've exported a table from an existing MSAccess database to my
> PostgreSQL db.
> I use a serial ID on the table and now I'm getting errors when I add a
> new entry in the table if i don't specify the ID by hand (which should
> be placed automatically by the db  since it's a serial).
> 
> The exact error is this one:
> 
> Cannot insert a duplicate key into a unique index.
> 
> 
> I think I should set the "last_value" field in the sequence to my real
> last value aon the ID field of the table, but Idon't know how to do it.
> Is there anybody who can help me ?
you can get "last_value":
select max(ID) from table 
you can create sequence with option 'start last_value+1' ( see man ).
> 
> Thanks
> 
> Valerio Santinelli
> [EMAIL PROTECTED]
> 
> 
> 




Re: [GENERAL] How to increment by hand a sequence number.

1999-01-18 Thread Jeong Jae Ick:정재익:

It maybe done with next syntax;
   drop sequence_name;
   create sequence sequence_name start start_no;

But, if you want to increment the sequence_no by one manually, then;
   select nextval('sequence_name');

==ooOO /. .\ OOoo==
 Dept. of Neurosurgery | http://advance.sarang.net
 Masan Military Hospital   | http://database.sarang.net
 Korea | [EMAIL PROTECTED]
   | [EMAIL PROTECTED]
 Hanil-Town 201-2007, Yangduk2-Dong| Phone: +82-551-299-2624
 Hwoiwon-Gu, Masan-Si, Kyungnam| O.P. : +82-551-271-2318
OOo./-\.oOO

On Mon, 18 Jan 1999, Valerio Santinelli wrote:

> I've exported a table from an existing MSAccess database to my
> PostgreSQL db.
> I use a serial ID on the table and now I'm getting errors when I add a
> new entry in the table if i don't specify the ID by hand (which should
> be placed automatically by the db  since it's a serial).
> 
> The exact error is this one:
> 
> Cannot insert a duplicate key into a unique index.
> 
> 
> I think I should set the "last_value" field in the sequence to my real
> last value aon the ID field of the table, but Idon't know how to do it.
> Is there anybody who can help me ?
> 
> Thanks




[GENERAL] How to increment by hand a sequence number.

1999-01-18 Thread Valerio Santinelli

I've exported a table from an existing MSAccess database to my
PostgreSQL db.
I use a serial ID on the table and now I'm getting errors when I add a
new entry in the table if i don't specify the ID by hand (which should
be placed automatically by the db  since it's a serial).

The exact error is this one:

Cannot insert a duplicate key into a unique index.


I think I should set the "last_value" field in the sequence to my real
last value aon the ID field of the table, but Idon't know how to do it.
Is there anybody who can help me ?

Thanks

Valerio Santinelli
[EMAIL PROTECTED]





[GENERAL] Postgres' DBI(Pg) problems.

1999-01-18 Thread R\imi Lehn


Your script worked for me (I skipped everything related to
forms-lib), but :

- /*  */ C-style comments are not allowed by perl (line #2)
- you should $sth->finish() and $dbh->disconnect() at the end of your
  script to avoid warnings ("Database handle destroyed without
  explicit disconnect.")

I assumed that your table course has two fields, both are
type text. Check that your fields are not numbers (inserted values
are quoted (line #13)).

You can replace $sth->prepare() and $sth->execute() by a
$sth->do( "your query" ); as your query has no output row.

Check your web server's logs. At least for apache, stderr
of cgi scripts is dumped in an error log. Try running your script
offline. A common mistake is not having access to your database
with the uid endorsed by your web server (apache usually runs
cgi scripts as nobody which may not have INSERT permissions on
the table).

Hope it will help.
Rémi.

Kevin Lo writes:
 > Hi,
 > 
 > I'm trying to use Postgres DBI, which is Pg, to write a simple cgi script.
 > But I encounter a problem, hope anyone can tell me how to do, thanks.
 > 
 > For example:
 > I have two input forms in ex.html, which names are 'id' and 'student'.
 > I want to insert them into 'course' table in student database by using Pg.
 > The script I wrote as following:
 > 
 > #!/usr/local/bin/perl
 > require 'forms-lib.pl';/* this script gets form values in HTML that I input */
 > use DBI;
 > print "Content-type: text/html\n\n";
 > print "\n";
 > print "\n";
 > print "Data inserted\n";
 > print "\n";
 > %input = &GetFormInput();
 > $v1 = $input{'id'};
 > $v2 = $input{'student'};
 > $dbh = DBI->connect("dbi:Pg:dbname=student") or die $DBI::errstr;
 > $sth = $dbh->prepare("insert into course values('$v1', '$v2')")
 >  or die $DBI::errstr;
 > $sth->execute or  die $DBI::errstr;
 > print "\n";
 > print "Data inserted!\n";
 > print "\n";
 > print "\n";
 > 
 > After executing this script, I just see brower's title "Data inserted",
 > I can't see "Data inserted!" in HTML and can't insert values into 'course'
 > table. I don't know how to do, would anyone tell me, thanks in advance.
 > 
 > Best regards,
 > Kevin.
 > 
 >