Re: [GENERAL] PHP-Postgres link

2000-04-09 Thread Charles Tassell

Try replacing $connection = pg_connect("", "", "", "users"); with 
$connection = pg_connect("dbname=users")   or you might want to try 
$connection = pg_connect("dbname=users user=nobody")

At 11:53 AM 4/9/00, Ramses v. Pinxteren wrote:
>Hi,
>
>I am running PHP under APache with a link to a postgres database. It gives
>me a headache because it is not working.
>
>I am running Apache as nobody, and I have made a Postgres user also named
>nobody.
>
>I made a postgres database users (as nobody: createdb users) and with psql a
>database login (field 1: userindex, field 2 username, field 3 password,
>field 4 security level)
>
>with psql i can do everything I want with this table. adding tuples,
>deleting them etc. etc.
>
>Now what do i need: I need a script that adds a new user to this database.
>so I created this:
> $connection = pg_connect("", "", "", "users");
> echo ("$connection");
> $query = "INSERT INTO users.login VALUES ( '$userindex', '$uname',
>'$passwrd1', '1')";
> echo ("$query");
> $result = pg_exec ($connection, "select *");
> print (pg_cmdtuples($result));
> pg_close($connection);
>?>
>
>This generates an error at the HTML output:
>
>1INSERT INTO login VALUES ( '1', 'test', 'test', '1');
>Warning: PostgresSQL query failed: ERROR: login: Table does not exist. in
>/usr/local/apache/htdocs/isis.cx/database_update.php3 on line 6
>
>Warning: 0 is not a PostgresSQL result index in
>/usr/local/apache/htdocs/isis.cx/database_update.php3 on line 7
>
>
>in the logffiles is specifies:
>FindExec: found "/usr/local/postgres/bin/postgres" using argv[0]
>started: host=localhost user=nobody database=users
>InitPostgres
>StartTransactionCommand
>ERROR:  login: Table does not exist.
>AbortCurrentTransaction
>proc_exit(0) [#0]
>shmem_exit(0) [#0]
>exit(0)
>/usr/local/postgres/bin/postmaster: reaping dead processes...
>/usr/local/postgres/bin/postmaster: CleanupProc: pid 19113 exited with
>status 0
>
>
>I am a complete newby, so please go easy on me!
>
>Tnx!
>Ramses
>
>
>




Re: [GENERAL] A Haunted Database

2000-04-09 Thread Charles Tassell

Vacuuming is sort of necessary at the moment, because if you don't vacuum, 
postgres won't use your indexes. :(  This is supposedly going to be fixed 
in the 7.x series (7.5 I think I heard) but I've never heard of a vacuum 
corrupting a normally working database in the 4 or 5 months I've been 
reading the GENERAL list (or at least I don't remember it...)

Can you post your vacuum script?  Maybe it's doing something besides the 
vacuum and that's what's corrupting your database.  Other than that, the 
only thing I can think off is that the vacuum is scanning the fields of 
your table and is changing ones that have a specific pattern.  That would 
be a VERY bad bug, so you would think it would have cropped up before.

BTW: What version are you using?  We use 6.5.3 here, and haven't had any 
problems.


At 11:56 AM 4/9/00, Robert Cleveland wrote:
>Thanks! Turning off the nightly vacuum script did the trick. Now . . . any
>idea why vacuum would be so damaging? It certainly appears, at least for me,
>that the routine is more trouble than it is worth. Is it a malfunction that
>can be overwritten or a bug or something else?
>
>Again many thanks. I can sleep without fear now
>
>Rob
>
>
>
> >Do you have any automated program accessing the database overnight?  IE a
> >malfunctioning backup or vacuum script?  You might also want to do a diff
> >-C1 first_dump second_dump to see what is actually being changed.
> >
> >At 11:40 AM 4/8/00, Robert Cleveland wrote:
> >>Here's a mystery I hope someone can solve for me.
> >>
> >>We are entering blocks of HTML into a table called bodyparts. We use PHP3
>to
> >>break up these blocks into several chunks to keep the length below the
> >>maximum. When the end user calls up the section, the "bodyparts" are
> >>extracted and re-assembled.
> >>
> >>The output pages work fine . . . for a while. We set up the output pages
> >>during the day, check them for accuracy and go to bed thinking we have
>done
> >>a great job. Then , in the middle of the night, something happens and when
> >>we awake, we find the HTML has been scrambled like so many breakfast eggs.
> >>Not all sections are scrambled. In fact it is the same sections every
>single
> >>time. So we re-enter the data, check it, assume we are done, and then the
> >>same thing happens the next day.
> >>
> >>To gather some empirical evidence, I ran pg_dump at 7pm on the offending
> >>table. I check the output pages at midnight the same evening, and they all
> >>were good. When I got back in front of the computer at 9am, the pages were
> >>scrambled again. I ran pg_dump a second time to a separate file. The file
> >>sizes were different (insert scary music here). No one had touched the
> >>database or the pages.
> >>
> >>I reloaded the data and everything is back to normal. But I suspect it
>will
> >>happen again tonight and I am afraid. Does anyone know what inhuman entity
> >>might be causing this to occur?
> >>
> >>




Re: [GENERAL] Permission denied while importing data from a file?

2000-04-09 Thread Charles Tassell

Try moving the file into /tmp and seeing if that works.  Sometimes you run 
into problems with having permissiosn on the file, but not all of the 
directories before it.  You must have execute permissions on all parent 
directories in order to access a file in one of those dirs.   The file will 
only need read access (444), although the others won't stop it from working 
(it will just be less secure if you are on a multi-user system.)

Also, I believe that one of the copy commands (either \copy or the COPY SQL 
command) can only be done as the database super user (postgres or pgsql, 
depending on how you installed Postgres)  Maybe you are using the wrong one?

At 01:16 PM 4/9/00, you wrote:
>LS,
>
>i'm trying to copy data into a table using a copy command using:
>
>COPY tabelName FROM '/somewhere/somebody/datafile.txt';
>
>I've given everybody the right to use the datafile.txt (execute, read,
>write) with an incredible chmod . Still i get the message:
>
>ERROR:  COPY command, running in backend with effective uid nr 666,
>could not open file '/somewhere/somebody/datafile.txt' for reading.
>Errno = Permission denied (13).
>
>Why? I mean how does this happen?
>Please help...
>
>Felix




[GENERAL] [NOVICE] installation question

2000-04-09 Thread Vipin Samtani

hi, 
i am a novice user running Red Hat Linux Server 6.
what files do i need to download to install PostGreSQL?
vipin





Re: [GENERAL] Selecting field names?

2000-04-09 Thread Charles Tassell

Yes, if you start psql with the -E switch (ie, psql -E -h dbserver 
database) then do a \d tablename it will show you the SQL query that's used 
to display the table definition.  You can then use this to do your 
selects.  Here is what I get when I do the above:

QUERY: SELECT a.attnum, a.attname, t.typname, a.attlen, a.atttypmod, 
a.attnotnull, a.atthasdef FROM pg_class c, pg_attribute a, pg_type t WHERE 
c.relname = 'tablename'and a.attnum > 0 and a.attrelid = 
c.oid and a.atttypid = t.oid   ORDER BY attnum

QUERY: SELECT viewname, definition FROM pg_views WHERE viewname like 
'tablename'


At 12:57 PM 4/9/00, Michael Hall wrote:
>Is there a way to 'select' the names of the fields and the field types
>of a table?
>
>--
>Michael J. Hall, CCAIntelligence Technologies Int'l
>[EMAIL PROTECTED]http://www.inteltec.com
>secure: [EMAIL PROTECTED]




[GENERAL] Minor hack to support LO string searches

2000-04-09 Thread Titus Brown

Hi, all, at

http://www.idyll.org/~t/www-tools/

you'll find an add-on function to PostgreSQL 6.5.3 that allows one to
do string searches through large objects.

It's not a terribly good hack, but it works ;).

I do plan on extending this add-on to support regular expressions Real
Soon.

There are a couple of other software hacks on the same page, including
one that lets you retrieve large objects through the AOLserver database
driver for PostgreSQL.

cheers,
--titus
-- 
Titus Brown, [EMAIL PROTECTED]



Re: [GENERAL] OID rollover?

2000-04-09 Thread Bruce Momjian

> What happens to my database when the OID rolls over?
> 
> If the answer is "doom", is there anything I can do about it?
> 

Actually, no one has every reported a roll-over, so I can't say for
sure.  They are unsigned ints, so it should go past 2 gigs.  If it goes
past 4 gigs, it rolls to zero again.  Having duplicate oids in the same
table is really not a crisis, though there could be come oid collision
in the system tables that could cause problems.

-- 
  Bruce Momjian|  http://www.op.net/~candle
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [GENERAL] PHP-Postgres link

2000-04-09 Thread Tatsuo Ishii

> I am running PHP under APache with a link to a postgres database. It gives
> me a headache because it is not working.
> 
> I am running Apache as nobody, and I have made a Postgres user also named
> nobody.
> 
> I made a postgres database users (as nobody: createdb users) and with psql a
> database login (field 1: userindex, field 2 username, field 3 password,
> field 4 security level)
> 
> with psql i can do everything I want with this table. adding tuples,
> deleting them etc. etc.
> 
> Now what do i need: I need a script that adds a new user to this database.
> so I created this:
>  $connection = pg_connect("", "", "", "users");
> echo ("$connection");
> $query = "INSERT INTO users.login VALUES ( '$userindex', '$uname',
~~~Are you sure with this?
PostgreSQL does not accept "database.table" notion.

> '$passwrd1', '1')";
> echo ("$query");
> $result = pg_exec ($connection, "select *");
> print (pg_cmdtuples($result));
> pg_close($connection);
> ?>
> 
> This generates an error at the HTML output:
> 
> 1INSERT INTO login VALUES ( '1', 'test', 'test', '1');
> Warning: PostgresSQL query failed: ERROR: login: Table does not exist. in
> /usr/local/apache/htdocs/isis.cx/database_update.php3 on line 6
> 
> Warning: 0 is not a PostgresSQL result index in
> /usr/local/apache/htdocs/isis.cx/database_update.php3 on line 7
> 
> 
> in the logffiles is specifies:
> FindExec: found "/usr/local/postgres/bin/postgres" using argv[0]
> started: host=localhost user=nobody database=users
> InitPostgres
> StartTransactionCommand
> ERROR:  login: Table does not exist.
> AbortCurrentTransaction
> proc_exit(0) [#0]
> shmem_exit(0) [#0]
> exit(0)
> /usr/local/postgres/bin/postmaster: reaping dead processes...
> /usr/local/postgres/bin/postmaster: CleanupProc: pid 19113 exited with
> status 0

Another possibility is you have two postmasters running. You connect
to wrong postmaster?
--
Tatsuo Ishii




Re: [GENERAL] A Haunted Database

2000-04-09 Thread Tatsuo Ishii

> Thanks! Turning off the nightly vacuum script did the trick. Now . . . any
> idea why vacuum would be so damaging? It certainly appears, at least for me,
> that the routine is more trouble than it is worth. Is it a malfunction that
> can be overwritten or a bug or something else?
> 
> Again many thanks. I can sleep without fear now
> 
> Rob
> 
> 
> 
> >Do you have any automated program accessing the database overnight?  IE a
> >malfunctioning backup or vacuum script?  You might also want to do a diff
> >-C1 first_dump second_dump to see what is actually being changed.
> >
> >At 11:40 AM 4/8/00, Robert Cleveland wrote:
> >>Here's a mystery I hope someone can solve for me.
> >>
> >>We are entering blocks of HTML into a table called bodyparts. We use PHP3
> to
> >>break up these blocks into several chunks to keep the length below the
> >>maximum. When the end user calls up the section, the "bodyparts" are
> >>extracted and re-assembled.

How small is the "chunk"? If you have an index on it, it must be much
smaller than 8k. I recommend lower than 2k.

P.S. Can you give me the dump file so that I could dig into the
problem.  I think pg_dump -t the_table_you_have_problems is probably
enough.
--
Tatsuo Ishii




[GENERAL] OID rollover?

2000-04-09 Thread Charles Martin

What happens to my database when the OID rolls over?

If the answer is "doom", is there anything I can do about it?



Re: [GENERAL] granting permission to groups?

2000-04-09 Thread Frank P. Miles

Peter Eisentraut wrote:
> 
> Frank Miles writes:
> 
> > I've been having problems trying to give permissions to groups, using
> > the Debian-packaged Postgresql 6.5.3.
> >
> > So far my search has turned up some old messages indicating that this
> > was broken in earlier versions of Postgresql.
> >
> > Can someone tell me whether this is the case with this version?  What
> > about 7.0?
> 
> 7.0 adds CREATE/ALTER/DROP GROUP commands but whether that helps depends
> on what "broken" refers to.
> 
> --
> Peter Eisentraut  Sernanders väg 10:115
> [EMAIL PROTECTED]   75262 Uppsala
> http://yi.org/peter-e/Sweden

Sorry for my lack of specificity.  Using the syntax in the 'GRANT'
section
of the Postgresql manual, I inserted a group into pg_group, then created 
users within that group, then granted SELECT permissions for the group.
There were no error messages; these steps appeared to work properly.
Unfortunately, users are still unable to do SELECTs, though they are
able
to do a 'psql database-name', and list the tables.

Is 7.0 necessary to get groups to work?  Or might I be missing something
else?  I didn't find where/which system table contained group/database
permissions, so could not confirm some of the aspects of the
configuration.

Any suggestions or references would be appreciated.

-frank



[GENERAL] Giving A DOG HEAD !!! Doggy blow job! 6158

2000-04-09 Thread fdpmjw

http://users2.50megs.com/loveline/dogblow.htm
lcbt




[GENERAL] Permission denied while importing data from a file?

2000-04-09 Thread Felix Slager

LS,

i'm trying to copy data into a table using a copy command using:

COPY tabelName FROM '/somewhere/somebody/datafile.txt';

I've given everybody the right to use the datafile.txt (execute, read,
write) with an incredible chmod . Still i get the message:

ERROR:  COPY command, running in backend with effective uid nr 666,
could not open file '/somewhere/somebody/datafile.txt' for reading. 
Errno = Permission denied (13).

Why? I mean how does this happen?
Please help...

Felix



[GENERAL] recursive queries?

2000-04-09 Thread Ron Peterson

Now and again, I find myself wanting to store data in some kind of
variable-level hierarchy.  To take a familiar example, let's say the
directory structure on my computer.

So I start to do something like:

CREATE SEQUENCE directory_id_seq;
CREATE TABLE directory {
parent  INTEGER,
nameTEXT,
id  INTEGER
DEFAULT nextval('directory_id_seq')
PRIMARY KEY
};

INSERT INTO directory
VALUES (1, '\.');

ALTER TABLE directory
ADD FORIEGN KEY (parent)
REFERENCES directory(id)
ON DELETE CASCADE
ON UPDATE CASCADE;

Happy, happy.  The problem is, while it's easy enough to define such a
data structure, support for recursive queries is rather lacking.  To
unroll a directory tree, you basically have to resort to programming in
.

Not that I really know what I'm talking about when I say 'unroll'.  This
data structure is general enough to support cyclic directed graphs.  So
what does it mean to 'unroll' such a beasty?

So what's my question then?  Well, it seems like maybe there _should_,
or at least _could_ be support for some kinds of common problems.  For
example, I would like to constrain my data structure to really be a
tree, and not a potentially cyclical graph.

Does anyone know whether there has been, or ever will be, movement in
this direction among the SQL literati?  Am I asking a completely
inappropriate question?

Perhaps these types of problems are what OODB adherents are attempting
to address.

So, to sum, my question:  Who plays in this space?  Will the SQL
standard itself ever play in this space?

Personally, I'm really only interested in something elegant.  Meaning I
don't want to mess around with a solution where this broker communicates
with that broker via an n-way blah blah blah.  I can maintain literacy
in several tools at once, but not several dozen.  Is my best bet simply
to accept SQL's limitations and program around them in C++ (or C, or
Python, or Perl, etc.)?

Ron Peterson
[EMAIL PROTECTED]