Re: [GENERAL] unintuitive subquery record wrapping

2010-09-17 Thread Tom Lane
Rikard Pavelic writes: > For basic query: > select t from t > result is of type t. yeah ... > If I query: > select sq from (select t from t) sq; > result is of type record. yeah ... it's a record containing a single field of type t. regards, tom lane -- Sent via pgsql

[GENERAL] unintuitive subquery record wrapping

2010-09-17 Thread Rikard Pavelic
I'm puzzled if this is by design or just overlooked... create table t(a int, b varchar); insert into t values(1,'x'); For basic query: select t from t result is of type t. If I query: select sq from (select t from t) sq; result is of type record. I need to query like this: select (sq).t from (

Re: [GENERAL] Referring to function parameter in function

2010-09-17 Thread Thom Brown
On 18 September 2010 00:52, Thom Brown wrote: > On 18 September 2010 00:14, Tom Lane wrote: >> Thom Brown writes: >>> ERROR:  invalid input syntax for integer: "bitlength" >>> LINE 1: SELECT GET_BIT(from_value::bit(bitlength), tap.value-1) >>>                                    ^ >> >>> I want t

Re: [GENERAL] Referring to function parameter in function

2010-09-17 Thread Thom Brown
On 18 September 2010 00:14, Tom Lane wrote: > Thom Brown writes: >> ERROR:  invalid input syntax for integer: "bitlength" >> LINE 1: SELECT GET_BIT(from_value::bit(bitlength), tap.value-1) >>                                    ^ > >> I want to use the parameter called "bitlength" as the length of

Re: [GENERAL] Referring to function parameter in function

2010-09-17 Thread Tom Lane
Thom Brown writes: > ERROR: invalid input syntax for integer: "bitlength" > LINE 1: SELECT GET_BIT(from_value::bit(bitlength), tap.value-1) >^ > I want to use the parameter called "bitlength" as the length of a bit > when casting a value. Hm, you can't ... th

[GENERAL] Referring to function parameter in function

2010-09-17 Thread Thom Brown
I appear to be having a problem with a function I've created, and no doubt it'll be something obvious I'm doing wrong. Here's my function: CREATE OR REPLACE FUNCTION get_lsfr( bitlength INT, taps INT[], from_value INT ) RETURNS INT AS $$ DECLARE last_tap_value BIT;

Re: [GENERAL] Need magic for identifieing double adresses

2010-09-17 Thread John DeSoi
On Sep 15, 2010, at 10:40 PM, Andreas wrote: > I need to clean up a lot of contact data because of a merge of customer lists > that used to be kept separate. > I allready know that there are double entries within the lists and they do > overlap, too. > > Relevant fields could be name, street,

Re: [GENERAL] Alter Table Command Rearranges Rows

2010-09-17 Thread Carlos Mennens
On Fri, Sep 17, 2010 at 4:32 PM, Michael Glaesemann wrote: > This isn't valid syntax: I believe you issued UPDATE users Woops. I did use the UPDATE and not ALTER command. On Fri, Sep 17, 2010 at 4:39 PM, Richard Broersma wrote: > On Fri, Sep 17, 2010 at 1:32 PM, Michael Glaesemann > wrote:

Re: [GENERAL] How to generate XML output from a Store Procedure

2010-09-17 Thread bricklen
On Fri, Sep 17, 2010 at 1:04 PM, Edwin Plauchu wrote: > Hello List > > I hope all of you are ok > > I would like to know if exist a manner to obtain a output on xml format from > a store procedure > > It may lead me to improve my current develop practices when I have to send a > Xml ouput which I

Re: [GENERAL] Alter Table Command Rearranges Rows

2010-09-17 Thread Richard Broersma
On Fri, Sep 17, 2010 at 1:32 PM, Michael Glaesemann wrote: > Postgres (nor any other SQL RDBMS) does not guarantee row order unless you > specify it with an ORDER BY clause. This is true, but some database will maintain a tables clustering. MS-Access comes to mind. I don't know if MySQL does t

Re: [GENERAL] missing chunk number 497 for toast value 504723663

2010-09-17 Thread Joshua J. Kugler
On Friday 17 September 2010, Tom Lane elucidated thus: > "Joshua J. Kugler" writes: > > On Thursday 16 September 2010, Tom Lane elucidated thus: > >> Update. Whatever reasons you might have for running 7.3.2 are bad > >> ones. > > > > Disclaimer: I agree with Tom; running 7.3.2 is a bad idea. > >

Re: [GENERAL] Alter Table Command Rearranges Rows

2010-09-17 Thread Michael Glaesemann
On Sep 17, 2010, at 16:12 , Carlos Mennens wrote: > I noticed that my database was in order based on my primary key column > called 'id' which when from 1 (first) to 6 (last). Today I had to edit > table data which wasn't anything crazy: > > team=#ALTER users SET name = 'David' WHERE id = '1'; >

Re: [GENERAL] missing chunk number 497 for toast value 504723663

2010-09-17 Thread Tom Lane
"Joshua J. Kugler" writes: > On Thursday 16 September 2010, Tom Lane elucidated thus: >> Update. Whatever reasons you might have for running 7.3.2 are bad >> ones. > Disclaimer: I agree with Tom; running 7.3.2 is a bad idea. > That said: like he said, he can't. He's running RHEL 4.0. Presumably

Re: [GENERAL] Alter Table Command Rearranges Rows

2010-09-17 Thread Vick Khera
On Fri, Sep 17, 2010 at 4:12 PM, Carlos Mennens wrote: > Thanks for any assistance or clarification. > Rows in SQL are unordered. If you want an ordering, specify one on your SELECT. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: htt

[GENERAL] Alter Table Command Rearranges Rows

2010-09-17 Thread Carlos Mennens
I noticed that my database was in order based on my primary key column called 'id' which when from 1 (first) to 6 (last). Today I had to edit table data which wasn't anything crazy: team=#ALTER users SET name = 'David' WHERE id = '1'; UPDATE 1 Now when I do a 'SELECT * FROM users' command in Post

[GENERAL] How to generate XML output from a Store Procedure

2010-09-17 Thread Edwin Plauchu
Hello List I hope all of you are ok I would like to know if exist a manner to obtain a output on xml format from a store procedure It may lead me to improve my current develop practices when I have to send a Xml ouput which I want to transform by XSLT scripts. I'll be waiting for your commments

Re: [GENERAL] where does postgres keep the query result until it is returned?

2010-09-17 Thread Sam Mason
On Fri, Sep 17, 2010 at 04:51:46PM +0200, Willy-Bas Loos wrote: > i have a function that produces a result in xml. > that is one row, one value even, but it grows pretty large. > how is that handled? Rows are sent back in the entireity, so the PG instance would need enough memory to work with that

Re: [GENERAL] PLPGSQL function to search function source for a list of terms

2010-09-17 Thread bricklen
On Fri, Sep 17, 2010 at 10:17 AM, bricklen wrote: > On Fri, Sep 17, 2010 at 10:16 AM, Raymond O'Donnell wrote: >> On 17/09/2010 18:12, bricklen wrote: >>> >>> On Fri, Sep 17, 2010 at 9:57 AM, Raymond O'Donnell  wrote: That could be pretty useful - why don't you put it on the wiki?

Re: [GENERAL] missing chunk number 497 for toast value 504723663

2010-09-17 Thread Scott Marlowe
On Fri, Sep 17, 2010 at 11:42 AM, Joshua J. Kugler wrote: > On Thursday 16 September 2010, Tom Lane elucidated thus: >> "Utsav Turray" writes: >> > I am using postgres  7.3.2  on RHEL 4.0. >> >> Egad. >> >> > Secondly what are probable  reasons behind corruption and what can >> > we do to prevent

Re: [GENERAL] missing chunk number 497 for toast value 504723663

2010-09-17 Thread Joshua J. Kugler
On Thursday 16 September 2010, Tom Lane elucidated thus: > "Utsav Turray" writes: > > I am using postgres 7.3.2 on RHEL 4.0. > > Egad. > > > Secondly what are probable reasons behind corruption and what can > > we do to prevent this error. > > Update. Whatever reasons you might have for runnin

Re: [GENERAL] PLPGSQL function to search function source for a list of terms

2010-09-17 Thread bricklen
On Fri, Sep 17, 2010 at 10:16 AM, Raymond O'Donnell wrote: > On 17/09/2010 18:12, bricklen wrote: >> >> On Fri, Sep 17, 2010 at 9:57 AM, Raymond O'Donnell  wrote: >>> >>> That could be pretty useful - why don't you put it on the wiki? >>> >>> Ray. >>> >> I was going to put an entry at >> http://wi

Re: [GENERAL] PLPGSQL function to search function source for a list of terms

2010-09-17 Thread Raymond O'Donnell
On 17/09/2010 18:12, bricklen wrote: On Fri, Sep 17, 2010 at 9:57 AM, Raymond O'Donnell wrote: That could be pretty useful - why don't you put it on the wiki? Ray. I was going to put an entry at http://wiki.postgresql.org/wiki/Category:Library_Snippets, but I couldn't find the "edit" option.

Re: [GENERAL] PLPGSQL function to search function source for a list of terms

2010-09-17 Thread bricklen
On Fri, Sep 17, 2010 at 9:57 AM, Raymond O'Donnell wrote: > That could be pretty useful - why don't you put it on the wiki? > > Ray. > I was going to put an entry at http://wiki.postgresql.org/wiki/Category:Library_Snippets, but I couldn't find the "edit" option. Maybe I'm blind? I just noticed h

Re: [GENERAL] Transposing rows and columns

2010-09-17 Thread Aram Fingal
On Sep 17, 2010, at 9:00 AM, Steve Clark wrote: > I think excel 2007 can handle more than 65,535 rows. You may be right. I'm actually using NeoOffice (Mac enhanced version of OpenOffice) and that can handle something like 1,048,000 rows.I wouldn't be surprised if newer versions of Excel c

Re: [GENERAL] PLPGSQL function to search function source for a list of terms

2010-09-17 Thread Raymond O'Donnell
On 17/09/2010 17:37, bricklen wrote: Here is a plpsql function I put together to search db functions in schemas other than pg_catalog and information_schema. Not the greatest of coding, but it might help someone else trying to solve the same issue I was having: to search all public functions for

[GENERAL] PLPGSQL function to search function source for a list of terms

2010-09-17 Thread bricklen
Here is a plpsql function I put together to search db functions in schemas other than pg_catalog and information_schema. Not the greatest of coding, but it might help someone else trying to solve the same issue I was having: to search all public functions for a list of terms. Sample usage is below

Re: [GENERAL] SELF LEFT OUTER JOIN = SELF JOIN including NULL values

2010-09-17 Thread Sam Mason
On Fri, Sep 17, 2010 at 06:16:44PM +0200, julia.jacob...@arcor.de wrote: > Hello everybody out there using PostgreSQL, > > After having read the official documentation and having done extensive > web search, I'm wondering how to perform something like a SELF LEFT > OUTER JOIN in PostgreSQL, i.e. a

Re: [GENERAL] SELF LEFT OUTER JOIN = SELF JOIN including NULL values

2010-09-17 Thread Raymond O'Donnell
On 17/09/2010 17:16, julia.jacob...@arcor.de wrote: Hello everybody out there using PostgreSQL, After having read the official documentation and having done extensive web search, I'm wondering how to perform something like a SELF LEFT OUTER JOIN in PostgreSQL, i.e. a SELF JOIN on a table contain

[GENERAL] SELF LEFT OUTER JOIN = SELF JOIN including NULL values

2010-09-17 Thread julia . jacobson
Hello everybody out there using PostgreSQL, After having read the official documentation and having done extensive web search, I'm wondering how to perform something like a SELF LEFT OUTER JOIN in PostgreSQL, i.e. a SELF JOIN on a table containing NULL values in one of the columns to join. Tha

Re: [GENERAL] where does postgres keep the query result until it is returned?

2010-09-17 Thread Willy-Bas Loos
> If the question was about the final query result sent to the client: yes > we don't spill that to disk, nor "hold" it anywhere.  The backend > sends it to the client on-the-fly as each row is generated. thanks, i didn't know that. I asked because i have a function that produces a result in xml.

Re: [GENERAL] where does postgres keep the query result until it is returned?

2010-09-17 Thread Tom Lane
Sam Mason writes: > On Fri, Sep 17, 2010 at 02:14:57PM +0100, Sam Mason wrote: >> Postgres, the server software, will spill large results (and any >> intermediate working sets) to disk automatically as needed. I believe >> any memory allocated for this task will be up to work_mem in size. > That

Re: [GENERAL] What's wrong with this query?

2010-09-17 Thread Tom Lane
Mike Christensen writes: > Here's the query: > SELECT R.RecipeId, R.Title, R.Description, R.ImageUrl, R.Rating, > R.PrepTime, R.CookTime, R.OwnerId, U.Alias, ts_rank_cd(R.TextSearch, > query) as Rank > FROM Recipes R, plainto_tsquery('veggie burgers') query > INNER JOIN Users U ON U.UserId = R.Own

Re: [GENERAL] where does postgres keep the query result until it is returned?

2010-09-17 Thread Sam Mason
On Fri, Sep 17, 2010 at 02:14:57PM +0100, Sam Mason wrote: > Postgres, the server software, will spill large results (and any > intermediate working sets) to disk automatically as needed. I believe > any memory allocated for this task will be up to work_mem in size. That wasn't very clear was it;

Re: [GENERAL] where does postgres keep the query result until it is returned?

2010-09-17 Thread Sam Mason
On Fri, Sep 17, 2010 at 03:00:36PM +0200, Willy-Bas Loos wrote: > Where does postgres keep the query result until it is returned? > In the shared_buffers? > Or in extra memory that was not previously allocated, or something else? Postgres, the server software, will spill large results (and any int

[GENERAL] where does postgres keep the query result until it is returned?

2010-09-17 Thread Willy-Bas Loos
Hi, Where does postgres keep the query result until it is returned? In the shared_buffers? Or in extra memory that was not previously allocated, or something else? What if the query result becomes very large, so that it won't fit into memory? cheers, WBL -- "Patriotism is the conviction that

Re: [GENERAL] Transposing rows and columns

2010-09-17 Thread Steve Clark
On 09/16/2010 05:26 PM, Aram Fingal wrote: On Sep 16, 2010, at 4:37 PM, John R Pierce wrote: On 09/16/10 10:44 AM, Aram Fingal wrote: I have thought about that but later on, when we do the full sized experiments, there will be too many rows for Excel to handle. if you insist on this transpo

[GENERAL] What's wrong with this query?

2010-09-17 Thread Mike Christensen
Here's the query: SELECT R.RecipeId, R.Title, R.Description, R.ImageUrl, R.Rating, R.PrepTime, R.CookTime, R.OwnerId, U.Alias, ts_rank_cd(R.TextSearch, query) as Rank FROM Recipes R, plainto_tsquery('veggie burgers') query INNER JOIN Users U ON U.UserId = R.OwnerId WHERE (R.TextSearch @@ query) AN

Re: [GENERAL] libssl issue ?

2010-09-17 Thread Peter Roethlisberger
Thanks for the input Tom. Compiling openssl with the shared option did the trick. On Thu, Sep 16, 2010 at 3:49 PM, Tom Lane wrote: > Craig Ringer writes: > > On 16/09/2010 4:35 PM, Peter Roethlisberger wrote: > >> /usr/local/openssl/lib64/libssl.a: could not read symbols: Bad value > > > Bad bu

Re: [GENERAL] Simple schema diff script in Perl

2010-09-17 Thread Florian Weimer
> sqlt-diff --to MySQL Schema1=MySQL Schema2=MySQL > SchemaUpdate.mysql.sql > > i can't guess where is the database name or user to use, if it work > with dumps i need to give the dump files and the database type... My version says: | Currently (v0.0900), only MySQL is supported by this code. I