Re: [GENERAL] Sequence

2008-07-24 Thread Craig Ringer
Alex Cheshev wrote: Hello. A table has two primary keys: It appears that you really meant "a table has a two-field composite primary key". There can only be one primary key for a table, that's the whole point - but the primary key can be composed of more than one field. [Note: if you forma

Re: [GENERAL] Sequence

2008-07-24 Thread A. Kretschmer
am Fri, dem 25.07.2008, um 15:54:23 +1100 mailte Alex Cheshev folgendes: > Hello. > A table has two primary keys: CREATE TABLE example ( pk1 integer, pk2 > integer, PRIMARY KEY (pk1, pk2) ). To add a new record I use command: > INSERT INTO example (pk1, pk2) VALUES (0, 0). Before adding the new

[GENERAL] Sequence

2008-07-24 Thread Alex Cheshev
Hello. A table has two primary keys: CREATE TABLE example ( pk1 integer, pk2 integer, PRIMARY KEY (pk1, pk2) ). To add a new record I use command: INSERT INTO example (pk1, pk2) VALUES (0, 0). Before adding the new record I have to find out the last value of pk2. How can I use something like t

Re: [GENERAL] php + postgresql

2008-07-24 Thread Chris
> 2. > Another problem was that no matter how many times I checked and > re-checked code, or which pg_fetch_* function I used, copying an array > member and trying to use it later just would not work, eg > > while ($row = pg_fetch_array($query)) { > $content = $row[0] > } > > echo $content;

Re: [GENERAL] php + postgresql

2008-07-24 Thread Chris
> There does seem to be some evidence of problems historically with PHP > and persistent connections in PostgreSQL, on the PHP forums. The advice > is typically to avoid them. You'll find the same advice for mysql + persistent connections or any other db + persistent connections. It's not a php+p

Re: [GENERAL] FK check will use index on referring table?

2008-07-24 Thread Scott Marlowe
On Thu, Jul 24, 2008 at 7:06 PM, Stephen Frost <[EMAIL PROTECTED]> wrote: > * John D. Burger ([EMAIL PROTECTED]) wrote: >> My understanding is that PG will use an index on the referring side of a >> foreign key for FK checks. How can I tell whether it's doing that? > > It should, when it makes sen

Re: [GENERAL] FK check will use index on referring table?

2008-07-24 Thread Tom Lane
Stephen Frost <[EMAIL PROTECTED]> writes: > * John D. Burger ([EMAIL PROTECTED]) wrote: >> My understanding is that PG will use an index on the referring side of a >> foreign key for FK checks. How can I tell whether it's doing that? There isn't any very good way at the moment :-( > If more t

Re: [GENERAL] FK check will use index on referring table?

2008-07-24 Thread Stephen Frost
* John D. Burger ([EMAIL PROTECTED]) wrote: > My understanding is that PG will use an index on the referring side of a > foreign key for FK checks. How can I tell whether it's doing that? It should, when it makes sense, yes. Having the actual schema definitions would help in debugging this, o

Re: [GENERAL] php + postgresql

2008-07-24 Thread Aarni Ruuhimäki
On Thursday 24 July 2008 12:41, admin wrote: > 1. > I ended up using pg_prepare() and pg_execute() as pg_query() alone just > didn't seem to work. But SELECT statements seemed to be cached or > persistent in some way, such that they "lived" beyond the life of the > PHP script. Is there something I

[GENERAL] FK check will use index on referring table?

2008-07-24 Thread John D. Burger
Hi - My understanding is that PG will use an index on the referring side of a foreign key for FK checks. How can I tell whether it's doing that? EXPLAIN ANALYZE just shows something like this: => explain analyze delete from segments where segmentid = 24305259;

Re: [GENERAL] [PERL DBI] Insertiing data across multiple tables

2008-07-24 Thread Klint Gore
JD Wong wrote: Does anybody know how to insert data over multiple tables transactionally? The relationship is 1:1 with the latter table having a foreign key constraint. In order to add data to Table2 I need to know the primary key value of the same record in Table1 before it's committed, whi

[GENERAL] PgDBF, Another XBase to PostgreSQL converter

2008-07-24 Thread Kirk Strauser
It'd been a couple of years since I wrote a program to convert some random database to PostgreSQL, and it seemed like time to crank out another one. The results, PgDBF, are available under the GPLv3 and downloadable from http://honeypot.net/project/pgdbf . Why yet another program to conver

Re: [GENERAL] [PERL DBI] Insertiing data across multiple tables

2008-07-24 Thread SCassidy
[EMAIL PROTECTED] wrote on 07/24/2008 01:36:27 PM: > Does anybody know how to insert data over multiple tables > transactionally? The relationship is 1:1 with the latter table > having a foreign key constraint. In order to add data to Table2 I > need to know the primary key value of the same

Re: [GENERAL] mac install question

2008-07-24 Thread Dave Page
On Thu, Jul 24, 2008 at 3:57 PM, Shane Ambler <[EMAIL PROTECTED]> wrote: > Shane Ambler wrote: >> >> [EMAIL PROTECTED] wrote: >> >>> Is the otool program on your system anywhere? Afaik, it should be on >>> any Mac, but maybe it's part of xcode (i hope not- can anyone >>> confirm?) >> >> I have a fe

[GENERAL] [PERL DBI] Insertiing data across multiple tables

2008-07-24 Thread JD Wong
Does anybody know how to insert data over multiple tables transactionally? The relationship is 1:1 with the latter table having a foreign key constraint. In order to add data to Table2 I need to know the primary key value of the same record in Table1 before it's committed, which in this case is a

Re: [GENERAL] mac install question

2008-07-24 Thread Dave Page
On Thu, Jul 24, 2008 at 12:55 PM, John DeSoi <[EMAIL PROTECTED]> wrote: > > On Jul 24, 2008, at 1:51 AM, Tom Lane wrote: > >> Relative paths sound like the best solution to me, assuming they work. > > Relative paths work fine. I use this all the time for distributing psql. It > looks something like

Re: [GENERAL] UPDATE runs slow in a transaction

2008-07-24 Thread Tom Lane
Viktor Rosenfeld <[EMAIL PROTECTED]> writes: > Postgres is indeed selecting a bad plan. Turns out that the index I > created to speed up the UPDATE isn't used inside a transaction block. I was having a hard time believing that, but just noticed that there is a case in which it could be expected

Re: [GENERAL] invalid byte sequence for encoding "UNICODE"

2008-07-24 Thread Tom Lane
AlannY <[EMAIL PROTECTED]> writes: > Many times, I'm confronting with that strange problem: invalid byte > sequence for encoding "UNICODE". So, I guess, Postgresql can't allow me > to use some symbols which is not a part of UNICODE. But what is that > symbals? Doesn't it tell you? AFAICS every

[GENERAL] invalid byte sequence for encoding "UNICODE"

2008-07-24 Thread AlannY
Hi there. Many times, I'm confronting with that strange problem: invalid byte sequence for encoding "UNICODE". So, I guess, Postgresql can't allow me to use some symbols which is not a part of UNICODE. But what is that symbals? I'm attaching a screenshot with THAT dead-symbol. As you can see

Re: [GENERAL] php + postgresql

2008-07-24 Thread Scott Marlowe
On Thu, Jul 24, 2008 at 6:33 AM, admin <[EMAIL PROTECTED]> wrote: > Thanks again for replies. > I know those questions were pretty vague. > I need to set up some methodical test scripts that replicate my problems, so > that it is clear what is going on. > > There does seem to be some evidence of pr

Re: [GENERAL] open_sync fails

2008-07-24 Thread Rick Weber
Definitely believable. It gives me an internal avenue to chase down. Thanks --Rick Alvaro Herrera wrote: Rick Weber wrote: While working on tuning my database, I was experimenting with changing the wal_sync_method to try to find the optimal value. The really odd thing is when I swi

Re: [GENERAL] open_sync fails

2008-07-24 Thread Alvaro Herrera
Rick Weber wrote: > While working on tuning my database, I was experimenting with changing > the wal_sync_method to try to find the optimal value. The really odd > thing is when I switch to open_sync (O_SYNC), Postgres immediately fails > and gives me an error message of: > > 2008-07-22 11:

Re: [GENERAL] open_sync fails

2008-07-24 Thread Tom Lane
Rick Weber <[EMAIL PROTECTED]> writes: > Basic system setup: > Linux 2.4 kernel (heavily modified) "Heavily modified" meaning what exactly? Given that no one else has reported such a thing, and the obvious bogosity of the errno code, I'd certainly first cast suspicion on the kernel.

[GENERAL] open_sync fails

2008-07-24 Thread Rick Weber
Basic system setup: Linux 2.4 kernel (heavily modified) Dual core Athlon Opteron 4GB ECC RAM SW RAID 10 configuration with 8 750 Gb disks (using only 500Gb of each disk) connected via LSISAS1068 based card While working on tuning my database, I was experimenting with changing the wal_sync_me

[GENERAL] cursor

2008-07-24 Thread Bob Pawley
I understand that a cursor can be opened and used through sql commands. However, when a host application accesses a particular row on a particular table can that be detected within the sql medium? Or does that information have the be accessed by transmitting from the host? Bob -- Sent via

Re: [GENERAL] contrib catalogs

2008-07-24 Thread Kevin Neufeld
Thanx for tip, Tom. I'll definitely give that a try in my spare time. Cheers, Kevin Tom Lane wrote: Kevin Neufeld <[EMAIL PROTECTED]> writes: Tom Lane wrote: A superuser can create whatever he wants in pg_catalog. Whether this is a good idea or will behave smoothly is a topic that has not be

Re: [GENERAL] contrib catalogs

2008-07-24 Thread Tom Lane
Kevin Neufeld <[EMAIL PROTECTED]> writes: >> Tom Lane wrote: >>> A superuser can create whatever he wants in pg_catalog. Whether this >>> is a good idea or will behave smoothly is a topic that has not been >>> thought about, to my knowledge. > Sorry, Tom. I think you are mistaken. In my 8.3 inst

Re: [GENERAL] php + postgresql

2008-07-24 Thread Ivan Sergio Borgonovo
On Thu, 24 Jul 2008 11:13:52 -0400 "David Spadea" <[EMAIL PROTECTED]> wrote: > Mick, > > As I haven't seen anyone else say it, I just wanted to throw this > in. > > I'm not a PHP programmer, so I'm not very sure of PHP's scoping > rules, but this looks to me like a variable scoping problem. If >

Re: [GENERAL] contrib catalogs

2008-07-24 Thread Kevin Neufeld
Tom Lane wrote: A superuser can create whatever he wants in pg_catalog. Whether this is a good idea or will behave smoothly is a topic that has not been thought about, to my knowledge. regards, tom lane Sorry, Tom. I think you are mistaken. In my 8.3 instance, system catalo

Re: [GENERAL] C function :: SECOND PROBLEM SOLVED :: SPI_finish releases memory!

2008-07-24 Thread M. François Benoît-Marand
The second problem is now solved ! > Second problem: > When I try to give the output table, only the first line is correctly > returned. > I have introduced an analyse stage which reveals that the problem comes from > the loss of the information in my matrix data structure when the function is > c

Re: [GENERAL] php + postgresql

2008-07-24 Thread David Spadea
Mick, As I haven't seen anyone else say it, I just wanted to throw this in. I'm not a PHP programmer, so I'm not very sure of PHP's scoping rules, but this looks to me like a variable scoping problem. If the first time you've used $content is inside of the while(), it's probably going out of scop

Re: [GENERAL] contrib catalogs

2008-07-24 Thread Kevin Neufeld
Really? I didn't know that ... guess I never tried. I'll have to do some experimenting! Thanx Tom. -- Kevin Tom Lane wrote: Kevin Neufeld <[EMAIL PROTECTED]> writes: This might seem like a silly question, but what are the implications of PostgreSQL allowing developers to create custom catal

Re: [GENERAL] mac install question

2008-07-24 Thread Shane Ambler
Shane Ambler wrote: [EMAIL PROTECTED] wrote: Is the otool program on your system anywhere? Afaik, it should be on any Mac, but maybe it's part of xcode (i hope not- can anyone confirm?) I have a few installs here. now that I think about it - it may be a dev tools only thing. otool is incl

Re: [GENERAL] php + postgresql

2008-07-24 Thread admin
Thanks again for replies. I know those questions were pretty vague. I need to set up some methodical test scripts that replicate my problems, so that it is clear what is going on. There does seem to be some evidence of problems historically with PHP and persistent connections in PostgreSQL, on

Re: [GENERAL] mac install question

2008-07-24 Thread John DeSoi
On Jul 24, 2008, at 1:51 AM, Tom Lane wrote: Relative paths sound like the best solution to me, assuming they work. Relative paths work fine. I use this all the time for distributing psql. It looks something like this: install_name_tool -change /path/to/postgresql/lib/libpq.dylib @execu

Re: [GENERAL] Equality search on timestamp value returns no rows

2008-07-24 Thread Tomasz Ostrowski
On 2008-07-23 21:24, Keaton Adams wrote: > We run into a problem when an equality search on a timestamp column > returns no records, even when there are records to return, as in this > example: > > mxl=# select * from mxl_scheduler_queue where status_modified = > '2008-07-03 16:55:06.44695-06';

Re: [GENERAL] C function working with input/ouput tables failed !

2008-07-24 Thread M. François Benoît-Marand
FIRST PROBLEM IS SOLVED ! > First problem: > When I try to get the input table, the first element is forgotten, then, the > whole matrix is wrong! I have no idea of what happens… > > Example: > Input table Matrix obtained > By reading tuple by tuple

Re: [GENERAL] php + postgresql

2008-07-24 Thread Ivan Sergio Borgonovo
On Thu, 24 Jul 2008 12:30:22 +0200 "Leif B. Kristensen" <[EMAIL PROTECTED]> wrote: > On Thursday 24. July 2008, admin wrote: > >while ($row = pg_fetch_array($query)) { > > $content = $row[0] > >} > > > >echo $content; > > > >$content was always 'undeclared'. > > You have to use an intermediate

Re: [GENERAL] php + postgresql

2008-07-24 Thread Ivan Sergio Borgonovo
On Thu, 24 Jul 2008 19:11:36 +0930 admin <[EMAIL PROTECTED]> wrote: > 2. > Another problem was that no matter how many times I checked and > re-checked code, or which pg_fetch_* function I used, copying an > array member and trying to use it later just would not work, eg > > while ($row = pg_fet

Re: [GENERAL] php + postgresql

2008-07-24 Thread Leif B. Kristensen
On Thursday 24. July 2008, admin wrote: >It seems that some of PHP's PG functions have changed recently, are >there any known issues with them? I've been using PHP with PostgreSQL for 5 years, and haven't noticed any substantial changes. >while ($row = pg_fetch_array($query)) { > $content = $

Re: [GENERAL] High activity short table and locks

2008-07-24 Thread Richard Huxton
Guillaume Bog wrote: On Wed, Jul 23, 2008 at 11:17 PM, Richard Huxton <[EMAIL PROTECTED]> wrote: I tried a vacuum full and had to stop it as it was blocking the server for too long. Below is the partial results I got. It seems you are right: enormous amount of dead space and rows. I did the same

Re: [GENERAL] php + postgresql

2008-07-24 Thread Raymond O'Donnell
On 24/07/2008 11:13, Raymond O'Donnell wrote: $rs = pg_query($sql_string); while ($row = pg_fetch_assoc($rs) Whoops! - while ($row = pg_fetch_assoc($rs)) Ray. -- Raymond O'Donnell, Director of Music, Galway Cathedra

Re: [GENERAL] php + postgresql

2008-07-24 Thread adam_pgsql
Hi Mick, 1. I ended up using pg_prepare() and pg_execute() as pg_query() alone just didn't seem to work. But SELECT statements seemed to be cached or persistent in some way, such that they "lived" beyond the life of the PHP script. Is there something I need to know about persistent behav

Re: [GENERAL] php + postgresql

2008-07-24 Thread Richard Huxton
admin wrote: First, thanks to everyone who responded to my newbie questions yesterday, all clear now. I spent most of today struggling with apparently inconsistent behaviour while running SELECT statements on PG 8.1.9 using PHP 5.1.6 (these are both as supplied with CentOS 5.1, a fairly conse

Re: [GENERAL] php + postgresql

2008-07-24 Thread Raymond O'Donnell
On 24/07/2008 10:41, admin wrote: I ended up using pg_prepare() and pg_execute() as pg_query() alone just didn't seem to work. But SELECT statements seemed to be cached or persistent in some way, such that they "lived" beyond the life of the PHP script. Is there something I need to know about

[GENERAL] C function working with input/ouput tables failed !

2008-07-24 Thread M. François Benoît-Marand
Dear Postgre co-users, --- I just submit to this mailing list and I am not a really good English speaker, so excuse me if I don't respect some of the rules to apply. Just tell me! I work on Win32 OS with Postgre/Postgis/PgAdmin and I build dlls with DevCpp to create C functions.

Re: [GENERAL] php + postgresql

2008-07-24 Thread Craig Ringer
admin wrote: > First, thanks to everyone who responded to my newbie questions > yesterday, all clear now. > > I spent most of today struggling with apparently inconsistent behaviour > while running SELECT statements on PG 8.1.9 using PHP 5.1.6 (these are > both as supplied with CentOS 5.1, a fairl

[GENERAL] php + postgresql

2008-07-24 Thread admin
First, thanks to everyone who responded to my newbie questions yesterday, all clear now. I spent most of today struggling with apparently inconsistent behaviour while running SELECT statements on PG 8.1.9 using PHP 5.1.6 (these are both as supplied with CentOS 5.1, a fairly conservative distro

Re: [GENERAL] Full text index without accents

2008-07-24 Thread Fco. Mario Barcala
Finally I create a function like: CREATE OR REPLACE FUNCTION nonsensible (text) RETURNS text AS $$ DECLARE var1 varchar; BEGIN var1=replace($1, 'á', 'a'); var1=replace(var1, 'é', 'e'); var1=replace(var1, 'í', 'i'); var1=replace(var1, 'ó', 'o'); var1=replace(var1, 'ú', 'u'); var1=repl

Re: [GENERAL] pg_query transaction: auto rollback? begin or start?? commit or end???

2008-07-24 Thread Karsten Hilbert
> How can I > > even include something *outside* a transaction *inside* it I was referring to conditions outside the database which you detect while the transaction is in progress and which invalidate the semantic integrity of the transaction as a whole. Under such circumstances you would want to