RE: [GENERAL] pg_database corrupted(?) If so, what do I do????

1999-05-11 Thread Herouth Maoz

At 22:26 +0300 on 10/05/1999, Jonny Hinojosa wrote:


 The last 2 entries have been corrupted.  How do I (can I) correct these
 entries ??

Have you tried logging into psql (template1) as postgres and updating the
pg_database table?

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma





[GENERAL] VB6 ODBC PostgreSQL accessing failure.

1999-05-11 Thread Bill Draper

I have encountered a problem accessing my PostgreSQL database. I am 
accessing via VB6 using an ADODC/ODBC link with 32 columns in a 
postgresql table. If I access directly it fails with an 'unexpected failure' when 
attempting to use a drop down field list from a fields properties. If I use all the 
same structure but link from VB6 to the PostgreSQL table via an ODBC link in 
an Access database it all works fine. Also if I use 31 columns then it will 
access the table directly with no problems. I don't know if this is a VB6, ODBC, 
ADO,  or PostgreSQL problem. Any help would be gratefully appreciated. I am 
using the latest version of PostgreSQL and drivers.



Re: [GENERAL] pg_database corrupted(?) If so, what do I do????

1999-05-11 Thread Jonny Hinojosa

No, but I have tried to figure out how to do just that.  I have found no way
to effect these updates.  So which part of the docs did I sleep through???

All help is GREATLY appreciated.

Jonny

-Original Message-
From: Herouth Maoz [EMAIL PROTECTED]
To: Jonny Hinojosa [EMAIL PROTECTED]; PostgreSQL General
[EMAIL PROTECTED]
Date: Tuesday, May 11, 1999 4:30 AM
Subject: RE: [GENERAL] pg_database corrupted(?) If so, what do I do


At 22:26 +0300 on 10/05/1999, Jonny Hinojosa wrote:


 The last 2 entries have been corrupted.  How do I (can I) correct these
 entries ??

Have you tried logging into psql (template1) as postgres and updating the
pg_database table?

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma






Re: [GENERAL] pg_database corrupted(?) If so, what do I do????

1999-05-11 Thread Herouth Maoz

At 18:03 +0300 on 11/05/1999, Jonny Hinojosa wrote:


 No, but I have tried to figure out how to do just that.  I have found no way
 to effect these updates.  So which part of the docs did I sleep through???

 All help is GREATLY appreciated.

I can't test any advice I give on my own system, as it is used for
production. But let's see if we can do something.

If you tried to update the pg_database with UPDATE pg_database SET
datpath=datname WHERE datpath  datname; and it didn't work, you may try
the following:

make a copy of the hom and cdmwhere directories in the data directory, for
backup.

Try to DROP DATABASE on the above databases. See if they have disappeared
from the database list (you can use select * from pg_database instead of
psql -l if you are already in psql). If they did, remove or rename the hom
and cdmwhere directories, and re-create them, using the user.

You are now supposed to have two new empty databases with the old names.
Remove the newly created directories and rename the old ones back. Check to
see if you can connect.

It may be advisable to shut down the postmaster when you are changing
things in the data directory, and restart it for the next psql session.

Now, supposed the DROP DATABASE didn't work, and complains that it doesn't
find the directories. Then, if it were me, I would create copies of the
original hom and cdmwhere directories, but give them the names that appear
in the pg_database table (check to see if there are extra spaces there,
though). You can give names that contain spaces in unix, it's no problem.
And then I'd try the drop again.

I hope any of these suggestions helps. Just make sure you have a backup
copy of the directories somewhere safe.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma





Re: [GENERAL] pg_database corrupted(?) If so, what do I do????

1999-05-11 Thread Jonny Hinojosa

I was about to say:

  I tried to SIMPLY update the pg_database and it worked!.  I have a
tendency to overlook the simple solutions.

Thanks for ALL your help.  Maybe someday I'll be smart enough to help you.

Jonny


-Original Message-
From: Herouth Maoz [EMAIL PROTECTED]
To: Jonny Hinojosa [EMAIL PROTECTED]; PostgreSQL General
[EMAIL PROTECTED]
Date: Tuesday, May 11, 1999 10:52 AM
Subject: Re: [GENERAL] pg_database corrupted(?) If so, what do I do


At 18:03 +0300 on 11/05/1999, Jonny Hinojosa wrote:


 No, but I have tried to figure out how to do just that.  I have found no
way
 to effect these updates.  So which part of the docs did I sleep through???

 All help is GREATLY appreciated.

I can't test any advice I give on my own system, as it is used for
production. But let's see if we can do something.

If you tried to update the pg_database with UPDATE pg_database SET
datpath=datname WHERE datpath  datname; and it didn't work, you may try
the following:

make a copy of the hom and cdmwhere directories in the data directory, for
backup.

Try to DROP DATABASE on the above databases. See if they have disappeared
from the database list (you can use select * from pg_database instead of
psql -l if you are already in psql). If they did, remove or rename the hom
and cdmwhere directories, and re-create them, using the user.

You are now supposed to have two new empty databases with the old names.
Remove the newly created directories and rename the old ones back. Check to
see if you can connect.

It may be advisable to shut down the postmaster when you are changing
things in the data directory, and restart it for the next psql session.

Now, supposed the DROP DATABASE didn't work, and complains that it doesn't
find the directories. Then, if it were me, I would create copies of the
original hom and cdmwhere directories, but give them the names that appear
in the pg_database table (check to see if there are extra spaces there,
though). You can give names that contain spaces in unix, it's no problem.
And then I'd try the drop again.

I hope any of these suggestions helps. Just make sure you have a backup
copy of the directories somewhere safe.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma







[GENERAL] Int8: problems

1999-05-11 Thread Jelle Ruttenberg

Hello Thomas,

I installed the whole PostgreSQL-bundle, including int8, out of the box 
and now I'm trying to use the int8-datatype. It looks as if I can get a 
value in the table but not in a 'normal' way out of it. I tried your 
testscript itest.sql and below you see it's output.

Another (?) problem: when I put a unquoted value into an int8 (and also a 
float8), I get the following message:
pgsql= insert into qtest values(19990511161616);
NOTICE:  Integer input '19990511161616' is out of range; promoted to float
INSERT 148320 1
pgsql= select float8(q1) from qtest;
float8  

123 
123 
4.56789012345679e+15
4.56789012345679e+15
4.56789012345679e+15
19990511161616  
(6 rows)

Maybe you know a solution to this problems? At the moment I use the 
float8-datatype for large numbers, but, well: when there is an int8 why 
not use it...

Thank you,

Jelle.


pgsql= select version();
version 

PostgreSQL 6.4.2 on mips-sgi-irix6.2, compiled by cc


create table qtest(q1 int8, q2 int8);
CREATE

insert into qtest values('123','456');
INSERT 148298 1
insert into qtest values('123','4567890123456789');
INSERT 148299 1
insert into qtest values('4567890123456789','123');
INSERT 148300 1
insert into qtest values('4567890123456789','4567890123456789');
INSERT 148301 1
insert into qtest values('4567890123456789','-4567890123456789');
INSERT 148302 1

select * from qtest;
 q1| q2
---+---
9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644
(5 rows)


select q1, -q1 as minus from qtest;
 q1|  minus
---+---
9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644
(5 rows)


select q1, q2, q1 + q2 as plus from qtest;
 q1| q2|   plus
---+---+---
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
(5 rows)

select q1, q2, q1 - q2 as minus from qtest;
 q1| q2|  minus
---+---+---
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
(5 rows)

select q1, q2, q1 * q2 as multiply from qtest
 where q1  1000 or (q2  0 and q2  1000);
 q1| q2|   multiply
---+---+---
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
(3 rows)

--select q1, q2, q1 * q2 as multiply qtest
-- where q1  '1000'::int8 or (q2  '0'::int8 and q2  '1000'::int8);
select q1, q2, q1 / q2 as divide from qtest;
 q1| q2| divide
---+---+---
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644|9223091508918288644
(5 rows)


select q1, float8(q1) from qtest;
 q1|float8  
---+
9223091508918288644|123 
9223091508918288644|123 
9223091508918288644|4.56789012345679e+15
9223091508918288644|4.56789012345679e+15
9223091508918288644|4.56789012345679e+15
(5 rows)

select q2, float8(q2) from qtest;
 q2|float8   
---+-
9223091508918288644|456  
9223091508918288644|4.56789012345679e+15 
9223091508918288644|123  
9223091508918288644|4.56789012345679e+15 
9223091508918288644|-4.56789012345679e+15
(5 rows)

select q1, int8(float8(q1)) from qtest;
 q1|   int8
---+---
9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644
9223091508918288644|9223091508918288644

[GENERAL] More problems with arrays !!!!!

1999-05-11 Thread Carlos Peralta Ramirez

Hi,
I tried to create a function in C  that receive an array X like
argument, and return ane element of  him.

Here is the C code -

#include pgsql/postgres.h
#include stdio.h

int4 array_1(int4 x[]){
return(x[1]);
}

int4 array_2(int4 *x){
return(x[1]);
}

int4 array_3(int4 x[]){
return(*(x+1));
}

int4 array_4(int4 *x){
return(*(x+1));
}

/* Note, this functions are tests only,*/

then I ceate this functions in Postgresql -

testdb= create function array_1(_int4) returns int4 as
'/var/lib/pgsql/funciones/arraystest.so' language 'c';
CREATE
testdb= create function array_2(_int4) returns int4 as
'/var/lib/pgsql/funciones/arraystest.so' language 'c';
CREATE
testdb= create function array_3(_int4) returns int4 as
'/var/lib/pgsql/funciones/arraystest.so' language 'c';
CREATE
testdb= create function array_4(_int4) returns int4 as
'/var/lib/pgsql/funciones/arraystest.so' language 'c';
CREATE

Therefore I can call the functions , but I hope another results .

testdb= select array_1('{1,2,3,4}');
array_1

  40
(1 row)

testdb= select array_2('{1,2,3,4}');
array_2

  40
(1 row)

testdb= select array_3('{1,2,3,4}');
array_3

  40
(1 row)

testdb= select array_4('{1,2,3,4}');
array_4

  40
(1 row)

This means that the four functions returns the same value

testdb= select array_1('{1,4}');
array_1

  32
(1 row)

testdb= select array_1('{1,1}');
array_1

  32
(1 row)

testdb= select array_1('{3,2,3,3,4,5,6}');
array_1

  52
(1 row)

testdb= select array_1('{}');
array_1

  12
(1 row)

testdb= select array_1('{1}');
array_1

  28
(1 row)

It seems to be , this functions returns the bytes asigned to them.

What can I do, for get the element (e.g. the fisrt) of the array?


Thanks ,

PD: I want to do this, to make a function that return if a element  is
or not into an array.




Re: [GENERAL] Weird datetime problem

1999-05-11 Thread Chris Bitmead

It's not a timezone problem is it? Did the dates get re-loaded
correctly?

Andy Lewis wrote:
 
 I have 2 tables both of which have a datetime field and both have an
 identifier of date_submitted.
 
 I've been using(via PHP) a query of the following for a month or so with
 no problem:
 
 select count(*) from mytable1 where date_submitted  'today'::datetime
 
 and
 
 select count(*) from mytable2 where date_submitted  'today'::datetime
 
 Both queries were working fine until I dumped the data in mytable2 to
 file and reloaded it. Now I can enter a date and not get the rows that I
 put in today(or any other day).
 
 The date_submitted has a btree index on it. I've even dropped and created
 a new index and that still hasn't helped. I still come up with 0 rows
 found.
 
 All I'm trying to do is get the number of rows submitted since midnight.
 
 Oh, yeah, Postgres 6.4.2, PHP 3.0.7, Linux Slackware 2.0.35, Dual Pent
 450's.
 
 Anyone have any ideas?
 
 Thanks in advance.
 
 Andy



Re: [GENERAL] Weird datetime problem

1999-05-11 Thread Andy Lewis

I was thinking that it may be a timezone thing. Some of the dates are of
CDT and some are CST.

I live in Dallas which is the Central Time Zone.

I just don't understand. I seem to have alot of time/date problems with
Postgres. Maybe its just me.

Actually, now I see what is going on. I defined this column as type
datetime with a default to now(). At one time the default worked ok. Now
it doesn't work at all. Perhaps this is a bug? 

If I insert a record and not state a date_submitted value the value that I
get when I select that row is an eroneous date. However if I use now() even 
though it should default to now(), it works fine.

Maybe this message would be better posted in the hackers list.

Andy

d, 12 May 1999, Chris Bitmead
wrote:

 It's not a timezone problem is it? Did the dates get re-loaded
 correctly?
 
 Andy Lewis wrote:
  
  I have 2 tables both of which have a datetime field and both have an
  identifier of date_submitted.
  
  I've been using(via PHP) a query of the following for a month or so with
  no problem:
  
  select count(*) from mytable1 where date_submitted  'today'::datetime
  
  and
  
  select count(*) from mytable2 where date_submitted  'today'::datetime
  
  Both queries were working fine until I dumped the data in mytable2 to
  file and reloaded it. Now I can enter a date and not get the rows that I
  put in today(or any other day).
  
  The date_submitted has a btree index on it. I've even dropped and created
  a new index and that still hasn't helped. I still come up with 0 rows
  found.
  
  All I'm trying to do is get the number of rows submitted since midnight.
  
  Oh, yeah, Postgres 6.4.2, PHP 3.0.7, Linux Slackware 2.0.35, Dual Pent
  450's.
  
  Anyone have any ideas?
  
  Thanks in advance.
  
  Andy