[GENERAL] Installation problem

2009-06-06 Thread Pawan Agrawal
Dear Sir, I have installed postgresql 8.0 which is supportive to New genlib. But I am facing problem in connecting the database. during database connection the follwoing error is displayed. *psql: received invalid response to SSL negotiation. I am new to postgresql. Plese suggest me how can i solv

[GENERAL] Event System

2009-06-06 Thread Jean-Gérard Pailloncy
Hi, I study the possibility to devellop an application with libevent and postgresql. I discover that a new "Event System" will be present in libpq 8.4. I would like to know if, when I send asynchronously a query to the server with PQsendQuery/PQsendQueryPrepared, the "Event Callback Procedure" wi

Re: [GENERAL] Using results from RETURNING

2009-06-06 Thread Craig Ringer
Shak wrote: > Something like: > > SELECT COUNT(*) FROM (DELETE FROM a RETURNING *) ; > > sounds reasonable but results in a syntax error. I am able to return > single results into a variable or record, but not more than one result. Subqueries using DELETE ... RETURNING or UPDATE ... RETURNING

Re: [GENERAL] Creating schema, database, or table in different folder.

2009-06-06 Thread Craig Ringer
Carlos Oliva wrote: > Is there a way to create a database or a table of a database in its own > folder? You could use tablespaces for that bit, BUT: > We are looking for ways to backup the sytem files of the > database to tape and one to exclude some tables from this backup. you can't do that wi

Re: [GENERAL] Event System

2009-06-06 Thread Andrejs Cainikovs
Hi, I'm kinda interested in this too. Can someone please tell us how this feature will work, or at least point in right direction? Thanks, Andrejs Cainikovs. Jean-Gérard Pailloncy wrote: Hi, I study the possibility to devellop an application with libevent and postgresql. I discover that a n

[GENERAL] How to store text files in the postgresql?

2009-06-06 Thread DimitryASuplatov
Hello, I am very new to postgresql database. I`ve used a little of MySql previously. My task is to store a lot (10^5) of small ( <10 MB) text files in the database with the ability to restore them back to the hard drive on demand. That means that I need two functions. First - grab file from the

Re: [GENERAL] How to store text files in the postgresql?

2009-06-06 Thread Leif B. Kristensen
On Saturday 6. June 2009, DimitryASuplatov wrote: >Hello, > >I am very new to postgresql database. I`ve used a little of MySql >previously. > >My task is to store a lot (10^5) of small ( <10 MB) text files in the >database with the ability to restore them back to the hard drive on >demand. > >That

Re: [GENERAL] How to store text files in the postgresql?

2009-06-06 Thread Raymond O'Donnell
On 06/06/2009 11:41, DimitryASuplatov wrote: > My task is to store a lot (10^5) of small ( <10 MB) text files in the > database with the ability to restore them back to the hard drive on > demand. > > That means that I need two functions. First - grab file from the > directory, store it in the dat

[GENERAL] Select last week

2009-06-06 Thread Bill Moseley
I'm looking at ways to select rows with a timestamp column of "last week" relative to the current server time. In 8.3 there's "isoyear" so is this a good approach? extract( isoyear from foo_time ) = extract( isoyear from now() - interval '1 week' ) AND extract( week from foo

[GENERAL] Upgrade from Postgres 8.2.4 to 8.3.5

2009-06-06 Thread Nykolyn, Andrew P (AS)
I have successfully installed 8.3.5 as a fresh install on a Redhat 4.5 machine. Now I try to upgrade another Redhat 4.5 machine with an existing 8.2.4 install and the "make check" fails all tests. When I look at the results file for each type being tested I see the same error indicating that ther

Re: [GENERAL] PLPython function and multiple line insert

2009-06-06 Thread Igor Katson
Andi Klapper wrote: sql = "("INSERT INTO table1 (field1, field2, field3) VALUES ('abc', 'abc', TRUE), ('def', 'def', FALSE), ('ghi', 'ghi', TRUE");" pypl.execute(sql) . . $$ LANGUAGE 'plpythonu' VOLATILE I ran into trouble with quoting this

Re: [GENERAL] Upgrade from Postgres 8.2.4 to 8.3.5

2009-06-06 Thread Tom Lane
"Nykolyn, Andrew P (AS)" writes: > I have successfully installed 8.3.5 as a fresh install on a Redhat 4.5 > machine. Now I try to upgrade another Redhat 4.5 machine with an > existing 8.2.4 install and the "make check" fails all tests. When I > look at the results file for each type being tested

Re: [GENERAL] How to store text files in the postgresql?

2009-06-06 Thread Raymond O'Donnell
On 06/06/2009 14:37, DimitryASuplatov wrote: > But then comes the problem because the only command I found to read in > the file content is COPY but the following command would not work Yes, this wont work here - COPY is intended for reading an entire table to or from a disk file, not a single col

Re: [GENERAL] How to store text files in the postgresql?

2009-06-06 Thread DimitryASuplatov
Thank you very much. I`ve also worked out how to do this simply from bash ./bin/psql mypdb < On 06/06/2009 14:37, DimitryASuplatov wrote: > > But then comes the problem because the only command I found to read in > > the file content is COPY but the following command would not work > > Yes, this

Re: [GENERAL] limit table to one row

2009-06-06 Thread Grzegorz Jaśkiewicz
just change whatever you are storing to be in vertical structure, instead of horizontal. so instead of create table foo(a int, b int, c int, etc), try: create table foo(name varchar, val int); common mistake I've seen committed by people.. -- Sent via pgsql-general mailing list (pgsql-general@p

Re: [GENERAL] Installation problem

2009-06-06 Thread Vick Khera
On Sat, Jun 6, 2009 at 3:01 AM, Pawan Agrawal wrote: > I have installed postgresql 8.0 which is supportive to New genlib. But I am > facing problem in connecting the database. during database connection the > follwoing error is displayed. Postgres 8.0 is very old, especially if you are running it

Re: [GENERAL] limit table to one row

2009-06-06 Thread Merlin Moncure
On Thu, Jun 4, 2009 at 4:13 PM, Brandon Metcalf wrote: > Is there a way when creating a table to limit it to one row?  That is, > without using a stored procedure? > > I searched the documentation, but didn't find anything. > > -- you can also do it with a trigger. create or replace function one_

Re: [GENERAL] limit table to one row

2009-06-06 Thread Tom Lane
Merlin Moncure writes: > On Thu, Jun 4, 2009 at 4:13 PM, Brandon > Metcalf wrote: >> Is there a way when creating a table to limit it to one row?  That is, >> without using a stored procedure? > you can also do it with a trigger. If you're willing to use a trigger, just insert the one allowed ro

Re: [GENERAL] limit table to one row

2009-06-06 Thread Merlin Moncure
On Sat, Jun 6, 2009 at 2:07 PM, Tom Lane wrote: > Merlin Moncure writes: >> On Thu, Jun 4, 2009 at 4:13 PM, Brandon >> Metcalf wrote: >>> Is there a way when creating a table to limit it to one row?  That is, >>> without using a stored procedure? > >> you can also do it with a trigger. > > If you'

Re: [GENERAL] limit table to one row

2009-06-06 Thread Tom Lane
Merlin Moncure writes: > On Sat, Jun 6, 2009 at 2:07 PM, Tom Lane wrote: >> If you're willing to use a trigger, just insert the one allowed row >> and then install a trigger that throws error for any insert or delete >> attempt ... > what if you need to delete then insert? :-) Hmm ... I supposed

Re: [GENERAL] NOT NULL with CREATE TYPE

2009-06-06 Thread Merlin Moncure
On Fri, Jun 5, 2009 at 1:58 PM, Jean Hoderd wrote: > > Hi, > >> So I don't recommend you try to do this.  What is the actual problem >> you are trying to solve?  Why do you want the client library to be >> concerned with attnotnull at all? > > In general the client library needs to check attnotnull

[GENERAL] PostgreSQL and XA Distributed Transaction Protocol

2009-06-06 Thread Christian Ferrari
Hi all, I'm developing a new, free, XA compliant transaction manager. One of the first resource manager I would be glad to support is PostgreSQL; after some googling I have found no information related to PostgreSQL and XA protocol support. Can anyone give me more information related to this matt

Re: [GENERAL] limit table to one row

2009-06-06 Thread Leif B. Kristensen
On Saturday 6. June 2009, Grzegorz Jaśkiewicz wrote: >just change whatever you are storing to be in vertical structure, >instead of horizontal. so instead of create table foo(a int, b int, c >int, etc), try: > >create table foo(name varchar, val int); > >common mistake I've seen committed by people

Re: [GENERAL] How to store text files in the postgresql?

2009-06-06 Thread DimitryASuplatov
Thank you for answering. I`ve read a manual and now I have a more advanced question. 1/ I`ve created a table in the database mypdb=# create table pdb( index int, filename text, filecontent text ); 2/ Then I want to read a file into it First I insert metainfo mypdb=# insert into pdb (index , f

Re: [GENERAL] PostgreSQL and XA Distributed Transaction Protocol

2009-06-06 Thread Martin Gainty
from what i can see here autocommit is not supported http://archives.postgresql.org/pgsql-jdbc/2009-01/msg00027.php Not sure if autocommit is part of the JTA spec? Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentiali

Re: [GENERAL] Using results from DELETE ... RETURNING

2009-06-06 Thread David Fetter
On Fri, Jun 05, 2009 at 07:13:43PM -0400, Tom Lane wrote: > Merlin Moncure writes: > > On Fri, Jun 5, 2009 at 6:51 PM, Tom Lane wrote: > >> I think you can loop over the results in plpgsql, for instance > > > also sql functions can direct 'returning' results directly to the > > return of the func

Re: [GENERAL] Using results from DELETE ... RETURNING

2009-06-06 Thread Tom Lane
David Fetter writes: > Would it be super-complicated to do this with CTEs for 8.5? They seem to > have sane properties like getting executed exactly once. Hmm, interesting thought. The knock against doing RETURNING as an ordinary subquery is exactly that you can't disentangle it very well from

Re: [GENERAL] limit table to one row

2009-06-06 Thread Craig Ringer
Brandon Metcalf wrote: > Is there a way when creating a table to limit it to one row? That is, > without using a stored procedure? > > I searched the documentation, but didn't find anything. > CREATE TABLE x (...); CREATE UNIQUE INDEX x_only_one_row ON ((1)); -- Craig Ringer -- Sent via pg