Thursday, May 22, 2008

[pgsql-advocacy] Is the biggest SQL database in the world now a Postgres fork?

Interesting article here:

http://www.informationweek.com/news/software/database/showArticle.jhtml?articleID=207801436

Yahoo Claims Record With Petabyte Database

Yahoo claims it has the largest SQL database in a production
environment and that it will grow larger.
...
Yahoo started with the PostgreSQL engine and replaced the query
processing layer with code designed for its commodity hardware cluster.

--
Sent via pgsql-advocacy mailing list (pgsql-advocacy@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-advocacy

Re: [NOVICE] How to connect to the database server

Selon Guillaume Yziquel <guillaume.yziquel@bluebottle.com>:

> Harold A. Gim�nez Ch. a �crit :
> > Have you tried loging in with the default user (postgres)?
> >
> > psql -U postgres
> >
> > or, try su'ing as postgres and login in then:
> >
> > su - postgres<enter>
> > psql<enter>


Hello, Harold.

I thank you very much for your answer.

psql -U postgres yields:

> yziquel@seldon:~$ psql -U postgres
> psql: impossible de se connecter au serveur: Permission non accord�e
> Est-ce que le serveur tourne sur l'h�te local
> et accepte des connexions au socket Unix �
/var/run/postgresql/.s.PGSQL.5432 �?

Doing su - postgres and psql yields:

> postgres@seldon:~$ psql
> psql: FATAL: La base de donn�es � postgres � n'existe pas
> postgres@seldon:~$

Seems like I need to know what are the databases inside my cluster...

Thanks again for your help.

Guillaume.


> > On Thu, May 22, 2008 at 1:14 PM, <guillaume.yziquel@free.fr
> > <mailto:guillaume.yziquel@free.fr>> wrote:
> >
> > Hello list.
> >
> > My problem is the following: I've installed a postgresql server on
> > my debian
> > GNU/linux system. I've not installed for postgresql itself, but
> > rather because I
> > needed a database server for other applications that use the
> > database for
> > storage purposes.
> >
> > Usually, using aptitude is always a pleasure... However, I now have
> > a database
> > server and I do not have any more the credentials to access the
> > database as the
> > database administrator (or perhaps I have them somewhere, but I'm
> > unable to find
> > them again).
> >
> > My question is the following: How can I get to connect directly to
> > the database
> > as the database superuser? Do I need to delete and reinstall my
> > whole database?
> >
> > I've been looking for documentation on this topic, but perhaps in
> > the wrong
> > placem or perhaps in the right but failing to see the light... So if
> > you have a
> > relevant link, I'm dying to hear about it.
> >
> > Guillaume.


--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

Re: [PERFORM] Index creation time and distribution

On Thu, May 22, 2008 at 6:50 PM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
> Just curious, what happens if you create the date index first, then
> the clazz one?

It's not due to any cache effect if it's your question. It's mostly
CPU time and changing the order doesn't change the behaviour.

I'll make some tests with 8.3 in a few weeks (I'll be out of town next
week) to see if using PostgreSQL qsort reduces the problem.

--
Guillaume

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[PATCHES] Extending grant insert on tables to sequences

? config.log
? config.status
Index: src/backend/catalog/aclchk.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/catalog/aclchk.c,v
retrieving revision 1.146
diff -c -r1.146 aclchk.c
*** src/backend/catalog/aclchk.c 12 May 2008 00:00:46 -0000 1.146
--- src/backend/catalog/aclchk.c 22 May 2008 18:13:18 -0000
***************
*** 360,365 ****
--- 360,402 ----
}

ExecGrantStmt_oids(&istmt);
+
+ /*
+ * If the objtype is a relation and the privileges includes INSERT, UPDATE
+ * or SELECT then extends the GRANT/REVOKE to the sequences owned by the
+ * relation
+ */
+ if (istmt.objtype == ACL_OBJECT_RELATION) &&
+ (istmt.privileges & (ACL_INSERT | ACL_UPDATE | ACL_SELECT))
+ {
+ AclMode priv;
+ foreach(cell, istmt.objects)
+ {
+ InternalGrant istmt_seq;
+
+ istmt_seq.is_grant = istmt.is_grant;
+ istmt_seq.objtype = ACL_OBJECT_SEQUENCE;
+ istmt_seq.grantees = istmt.grantees;
+ istmt_seq.grant_option = istmt.grant_option;
+ istmt_seq.behavior = istmt.behavior;
+
+ istmt_seq.all_privs = false;
+ istmt_seq.privileges = ACL_NO_RIGHTS;
+
+ istmt_seq.objects = getOwnedSequences(lfirst_oid(cell));
+ if (istmt_seq.objects != NIL)
+ {
+ if (istmt.privileges & (ACL_INSERT))
+ istmt_seq.privileges |= ACL_USAGE;
+ else if (istmt.privileges & (ACL_UPDATE))
+ istmt_seq.privileges |= ACL_UPDATE;
+ else if (istmt.privileges & (ACL_SELECT))
+ istmt_seq.privileges |= ACL_SELECT;
+
+ ExecGrantStmt_oids(&istmt_seq);
+ }
+ }
+ }
}

/*
Hi,

The idea of this patch is to avoid the need to make explicit grants on
sequences owned by tables.

This patch make:
- GRANT INSERT ON TABLE extend to GRANT USAGE ON SEQUENCE (currval, nextval)
- GRANT UPDATE ON TABLE extend to GRANT UPDATE ON SEQUENCE (nextval, setval)
- GRANT SELECT ON TABLE extend to GRANT SELECT ON SEQUENCE (currval)

comments?

--
regards,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Guayaquil - Ecuador
Cel. (593) 087171157

Re: [ADMIN] Index problem...

On Thu, May 22, 2008 at 01:37:56PM -0400, Carol Walter wrote:
> When I ran the query you specified I got relname of "pg_toast_16429.
> When I ran the REINDEX TABLE pg_toast_16429 the system responds that
> relation "pg_toast_16429" does not exist.

I think it should be pg_toast.pg_toast_16429
so:
REINDEX TABLE pg_toast.pg_toast_16429;

check relnamespace in pg_class for this table, and check it against
pg_namespace to be sure.

depesz

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: [NOVICE] How to connect to the database server

Have you tried loging in with the default user (postgres)?

psql -U postgres

or, try su'ing as postgres and login in then:

su - postgres<enter>
psql<enter>

On Thu, May 22, 2008 at 1:14 PM, <guillaume.yziquel@free.fr> wrote:
Hello list.

My problem is the following: I've installed a postgresql server on my debian
GNU/linux system. I've not installed for postgresql itself, but rather because I
needed a database server for other applications that use the database for
storage purposes.

Usually, using aptitude is always a pleasure... However, I now have a database
server and I do not have any more the credentials to access the database as the
database administrator (or perhaps I have them somewhere, but I'm unable to find
them again).

My question is the following: How can I get to connect directly to the database
as the database superuser? Do I need to delete and reinstall my whole database?

I've been looking for documentation on this topic, but perhaps in the wrong
placem or perhaps in the right but failing to see the light... So if you have a
relevant link, I'm dying to hear about it.

Guillaume.

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

[pgsql-es-ayuda] Problema con pg_restore

Estimados,


Tengo el siguiente problema, necesito levantar un respaldo de una base
de datos (de una tabla en particular) y me arroja el siguiente Error:


pg_restore -d l151 respaldo.backup --data-only -t tabla -e
--no-data-for-failed-tables -c -v
pg_restore: connecting to database for restore
pg_restore: restoring data for table "tala"
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1793; 0 16482 TABLE
DATA tabla postgres
pg_restore: [archiver (db)] COPY failed: ERROR: secuencia de bytes no
válida para codificación «UTF8»: 0x9e
HINT: Este error tambien puede ocurrir si la secuendia de bites no
coincide con la codificacion esperada por el servidor, lo cual es
controlado por "client_encoding".
CONTEXT: COPY tabla, línea 2
pg_restore: *** aborted because of error


La tabla en cuestión tiene un campo bytea, El server esta WINXP y la
version de Postgres es 8.2.1,

Agradeciendo su Ayuda.

Victor Benitez

--
TIP 5: �Has le�do nuestro extenso FAQ?

http://www.postgresql.org/docs/faqs.FAQ.html

Re: [GENERAL] Short-circuiting FK check for a newly-added field

On Tue, May 20, 2008 at 02:25:15PM -0400, Decibel! wrote:
> I need to add a field to a fairly large table. In the same alter statement
> I'd like to add a FK constraint on that new field. Is there any way to
> avoid the check of the table that the database is doing right now? The
> check is pointless because the newly added field is nothing but NULLs.
>
I don't see the problem. FK constraints don't fire on NULL values. I
think you might be imagining that a problem exists when it doesn't.

If the FK column is created as NOT NULL, there is a problem. The best
way to handle this case is to add the column (allowing nulls), populate
the columns, then alter the column to make it NOT NULL. You can wrap
that all in a transaction if you like.

> This is version 8.1.mumble.
>
You can get the version using select version().


-Reece

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [ADMIN] Index problem...

When I ran the query you specified I got relname of "pg_toast_16429.
When I ran the REINDEX TABLE pg_toast_16429 the system responds that
relation "pg_toast_16429" does not exist.

Carol

On May 22, 2008, at 1:02 PM, Tomeh, Husam wrote:

>
> You may want to try to reindex the associated toast table and see if
> that clears it up.
>
> To get the name of the associated toast table, you may run this query:
>
> select relname from pg_class where oid =
> (select reltoastrelid from pg_class where relname = 'maps');
>
> Then, reindex it.
>
> reindex table "toast table name" ..
>
> -------
>
> Regards,
> Husam
>
> -----Original Message-----
> From: pgsql-admin-owner@postgresql.org
> [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Carol Walter
> Sent: Thursday, May 22, 2008 9:42 AM
> To: pgsql-admin@postgresql.org
> Subject: [ADMIN] Index problem...
>
> Greetings...
>
> I'm getting an error. The error says...
>
> places=# REINDEX INDEX maps_map_id_seq;
> ERROR: "maps_map_id_seq" is not an index
> places=# SELECT * FROM maps;
> ERROR: missing chunk number 0 for toast value 131343627
>
> I have tried reindexing the index, the table, and the database. I
> continue to get this error. What can I do to recover from this.
>
> Carol Walter
>
> PS Let me say that I know this is my fault. This index is very
> bloated. Yesterday, I tried to vacuum. I got errors because
> max_fsm_pages what set at a number that was too small.
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
> **********************************************************************
> This message contains confidential information intended only for
> the use of the addressee(s) named above and may contain information
> that is legally privileged. If you are not the addressee, or the
> person responsible for delivering it to the addressee, you are
> hereby notified that reading, disseminating, distributing or
> copying this message is strictly prohibited. If you have received
> this message by mistake, please immediately notify us by replying
> to the message and delete the original message immediately thereafter.
>
> Thank you.
>
> FADLD Tag
> **********************************************************************


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

[NOVICE] How to connect to the database server

Hello list.

My problem is the following: I've installed a postgresql server on my debian
GNU/linux system. I've not installed for postgresql itself, but rather because I
needed a database server for other applications that use the database for
storage purposes.

Usually, using aptitude is always a pleasure... However, I now have a database
server and I do not have any more the credentials to access the database as the
database administrator (or perhaps I have them somewhere, but I'm unable to find
them again).

My question is the following: How can I get to connect directly to the database
as the database superuser? Do I need to delete and reinstall my whole database?

I've been looking for documentation on this topic, but perhaps in the wrong
placem or perhaps in the right but failing to see the light... So if you have a
relevant link, I'm dying to hear about it.

Guillaume.

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

[GENERAL] Is this correct usage of generate_series?

Hi, there.

These three queries below works as I expect, which is wonderful, but are these correct usages?
If these are intended features, I would like them to be documented at
http://www.postgresql.org/docs/8.3/interactive/functions-srf.html

=> select generate_series(1, 3) as i;
 i
---
 1
 2
 3
(3 rows)

=> select 'a' as a, generate_series(1, 3) as i;
 a | i
---+---
 a | 1
 a | 2
 a | 3
(3 rows)

=> select 'a' as a, i from generate_series(1, 3) i;
 a | i
---+---
 a | 1
 a | 2
 a | 3
(3 rows)

Here is an example using this technique, which shows column positions and names in
the specified index.

select attnum, attname
from pg_catalog.pg_attribute a
join (
    select
    indrelid, indkey[i] as pos
    from (
        select
        indrelid, indkey, generate_series(lb, ub) as i
        from (
            select indrelid, indkey, array_lower(indkey, 1) as lb, array_upper(indkey, 1) as ub
            from pg_catalog.pg_index
            where indexrelid = (
                select oid
                from pg_catalog.pg_class
                where relnamespace = (select oid from pg_catalog.pg_namespace where nspname = 'public')
                and relkind = 'i'
                and relname = '<your_index_name_here>'
            )
        ) x
    ) y
) z on a.attrelid = z.indrelid and a.attnum = z.pos;

Thanks in advance,
Hiroaki Nakamura

Re: [ADMIN] Index problem...

You may want to try to reindex the associated toast table and see if
that clears it up.

To get the name of the associated toast table, you may run this query:

select relname from pg_class where oid =
(select reltoastrelid from pg_class where relname = 'maps');

Then, reindex it.

reindex table "toast table name" ..

-------

Regards,
Husam

-----Original Message-----
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Carol Walter
Sent: Thursday, May 22, 2008 9:42 AM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] Index problem...

Greetings...

I'm getting an error. The error says...

places=# REINDEX INDEX maps_map_id_seq;
ERROR: "maps_map_id_seq" is not an index
places=# SELECT * FROM maps;
ERROR: missing chunk number 0 for toast value 131343627

I have tried reindexing the index, the table, and the database. I
continue to get this error. What can I do to recover from this.

Carol Walter

PS Let me say that I know this is my fault. This index is very
bloated. Yesterday, I tried to vacuum. I got errors because
max_fsm_pages what set at a number that was too small.


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
**********************************************************************
This message contains confidential information intended only for the use of the addressee(s) named above and may contain information that is legally privileged. If you are not the addressee, or the person responsible for delivering it to the addressee, you are hereby notified that reading, disseminating, distributing or copying this message is strictly prohibited. If you have received this message by mistake, please immediately notify us by replying to the message and delete the original message immediately thereafter.

Thank you.

FADLD Tag
**********************************************************************

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: [GENERAL] Finding records that are not there

At 6:47 PM +0200 5/22/08, hubert depesz lubaczewski wrote:
>On Thu, May 22, 2008 at 12:21:35PM -0400, Owen Hartnett wrote:
>> The SQL I've tried is:
>> select commcost.maplot, commcost.unitno from commcost
>> where not exists(select 1 from commcost, bldg
>> where commcost.maplot = bldg.maplot and
>> commcost.unitno = bldg.unitno)
>> order by commcost.maplot
>
>change it to:
>
>> select commcost.maplot, commcost.unitno from commcost
>> where not exists(select 1 from bldg
>> where commcost.maplot = bldg.maplot and
>> commcost.unitno = bldg.unitno)
>> order by commcost.maplot
>
>or simply write:
>
>select * from commcost except select * from bldg;
>
>depesz

Thank you very much for your quick response!

-Owen

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Finding records that are not there

You have commcost in the correlated subquery which shouldn't be there.

Here are three ways to achieve the results you want:

select commcost.maplot,
commcost.unitno
from commcost
where not exists(select null
from bldg
where commcost.maplot = bldg.maplot
and commcost.unitno = bldg.unitno)
order by commcost.maplot;

select commcost.maplot,
commcost.unitno
from commcost
left join bldg
on commcost.maplot = bldg.maplot
and commcost.unitno = bldg.unitno
where bldg.maplot is null
order by commcost.maplot;

select commcost.maplot,
commcost.unitno
from commcost
except
select bldg.maplot,
bldg.unitno
from bldg
order by maplot;

Jon

> -----Original Message-----
> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
> owner@postgresql.org] On Behalf Of Owen Hartnett
> Sent: Thursday, May 22, 2008 11:22 AM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] Finding records that are not there
>
>
> Hi:
>
> This is gotta be elementary SQL 101, but I'm having a mental block as
> to why this doesn't work.
>
> I have two tables that have identical index fields, maplot and
> unitno, (both indexes span two columns) and I want to find all the
> records in the commcost table that don't have a corresponding record
> in the bldg file.
>
> The SQL I've tried is:
>
> select commcost.maplot, commcost.unitno from commcost
> where not exists(select 1 from commcost, bldg
> where commcost.maplot = bldg.maplot and
> commcost.unitno = bldg.unitno)
> order by commcost.maplot
>
> It returns no records although I know that there are records in
> commcost which do not match keys with records from bldg.
>
> Help! What am I doing wrong?
>
> -Owen
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [PERFORM] Index creation time and distribution

On Thu, May 22, 2008 at 6:32 AM, Guillaume Smet
<guillaume.smet@gmail.com> wrote:
> Hi -performance,
>
>
> LOG: duration: 1636301.317 ms statement: CREATE INDEX
> index_journal_clazz ON journal USING btree (clazz);
> LOG: duration: 20613.009 ms statement: CREATE INDEX
> index_journal_date ON journal USING btree (date);

Just curious, what happens if you create the date index first, then
the clazz one?

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Re: [GENERAL] Finding records that are not there

On Thu, May 22, 2008 at 12:21:35PM -0400, Owen Hartnett wrote:
> The SQL I've tried is:
> select commcost.maplot, commcost.unitno from commcost
> where not exists(select 1 from commcost, bldg
> where commcost.maplot = bldg.maplot and
> commcost.unitno = bldg.unitno)
> order by commcost.maplot

change it to:

> select commcost.maplot, commcost.unitno from commcost
> where not exists(select 1 from bldg
> where commcost.maplot = bldg.maplot and
> commcost.unitno = bldg.unitno)
> order by commcost.maplot

or simply write:

select * from commcost except select * from bldg;

depesz

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Finding records that are not there

> I have two tables that have identical index fields, maplot and
> unitno, (both indexes span two columns) and I want to find all the
> records in the commcost table that don't have a corresponding record
> in the bldg file.
>
> The SQL I've tried is:
>
> select commcost.maplot, commcost.unitno from commcost
> where not exists(select 1 from commcost, bldg
> where commcost.maplot = bldg.maplot and
> commcost.unitno = bldg.unitno)
> order by commcost.maplot
>
> It returns no records although I know that there are records in
> commcost which do not match keys with records from bldg.
>

You shouldn't put "commcost" in your inner select, since it's
already in your outer select.

Or try this, it's probably faster:

Select commcost.maplot, commcost.unitno from commcost c
left join bldg b on c.maplot = b.maplot and c.unitno = b.unitno
where b.unitno is null


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[ADMIN] Index problem...

Greetings...

I'm getting an error. The error says...

places=# REINDEX INDEX maps_map_id_seq;
ERROR: "maps_map_id_seq" is not an index
places=# SELECT * FROM maps;
ERROR: missing chunk number 0 for toast value 131343627

I have tried reindexing the index, the table, and the database. I
continue to get this error. What can I do to recover from this.

Carol Walter

PS Let me say that I know this is my fault. This index is very
bloated. Yesterday, I tried to vacuum. I got errors because
max_fsm_pages what set at a number that was too small.


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

[GENERAL] Finding records that are not there

Hi:

This is gotta be elementary SQL 101, but I'm having a mental block as
to why this doesn't work.

I have two tables that have identical index fields, maplot and
unitno, (both indexes span two columns) and I want to find all the
records in the commcost table that don't have a corresponding record
in the bldg file.

The SQL I've tried is:

select commcost.maplot, commcost.unitno from commcost
where not exists(select 1 from commcost, bldg
where commcost.maplot = bldg.maplot and
commcost.unitno = bldg.unitno)
order by commcost.maplot

It returns no records although I know that there are records in
commcost which do not match keys with records from bldg.

Help! What am I doing wrong?

-Owen

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Installed pgadmin3-1.4.3 with 8.3.1 database..errors

On May 22, 2008, at 6:38 AM, Barbara Stephenson wrote:

> Hello,
>
> We have recently upgraded from 7.4.19 to 8.3.1. I am running Red Hat
> Enterprise Linux WS release 4 (Nahant Update 6) on my laptop and I
> finally
> was able to install pgadmin3-1.4.3. However, when I expand my
> databases, I
> get two popups. Does anyone know what that means?

I'd guess it's that you're using an obsolete version of pgadmin that
doesn't know about system changes. 1.8.2 is the current version, I
think.

Cheers,
Steve

>
>
>
> FIRST POPUP:
> An error has occured:
>
> ERROR: column op.oprlsortop does not exist
> LINE 12: LEFT OUTER JOIN pg_operator lso ON lso.oid=op.oprlsortop
>
> SECOND POPUP:
> An error has occured:
>
> ERROR: column "opcamid" does not exist
> LINE 3: JOIN pg_am am ON am.oid=opcamid
> --
> Regards,
>
> Barbara Stephenson
> EDI Specialist/Programmer
> Turbo, division of Ozburn-Hessey Logistics
> 2251 Jesse Jewell Pkwy NE
> Gainesville, GA 30507
> tel: (678)989-3020 fax: (404)935-6171
> barbara@turbocorp.com
> www.ohlogistics.com
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [SQL] Substract queries

Thanks to all the EXEPT keyword is what I was looking for

On Thu, May 22, 2008 at 5:36 PM, Niklas Johansson <spot@tele2.se> wrote:

On 22 maj 2008, at 17.15, Nacef LABIDI wrote:
I was wondering how can I substract result between select queries. I mean I want to issue a query that does this :
(select * from mytable where condition1) - (select * from mytable where condition2)

If you (as implied above) query the same table in both cases, just do:

SELECT * FROM mytable WHERE condition1 AND NOT condition2

Otherwise, use EXCEPT:

SELECT * FROM mytable1 WHERE condition1
EXCEPT
SELECT * FROM mytable2 WHERE condition2

in which case both queries must return the same type of rows.




Sincerely,

Niklas Johansson




Re: [SQL] Substract queries

On 22 maj 2008, at 17.15, Nacef LABIDI wrote:
> I was wondering how can I substract result between select queries.
> I mean I want to issue a query that does this :
> (select * from mytable where condition1) - (select * from mytable
> where condition2)

If you (as implied above) query the same table in both cases, just do:

SELECT * FROM mytable WHERE condition1 AND NOT condition2

Otherwise, use EXCEPT:

SELECT * FROM mytable1 WHERE condition1
EXCEPT
SELECT * FROM mytable2 WHERE condition2

in which case both queries must return the same type of rows.


Sincerely,

Niklas Johansson


--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Substract queries

Nacef LABIDI wrote:
> Hi all,
>
> I was wondering how can I substract result between select queries. I mean I
> want to issue a query that does this :
> (select * from mytable where condition1) - (select * from mytable where
> condition2)

If the subqueries return single (scalar) results, you can just subtract
them directly:

SELECT (SELECT COUNT(id) FROM table1) - (SELECT COUNT(id) FROM table2)


However, I'm guessing you REALLY want to match the records up in two
tables and compare them.

In that case what you need to do is read this:

http://www.postgresql.org/docs/8.3/static/tutorial-join.html

and this:

http://www.postgresql.org/docs/8.3/static/queries.html

including this:

http://www.postgresql.org/docs/8.3/static/queries-table-expressions.html#QUERIES-FROM

then use a JOIN to combine both tables, matching up corresponding
records in each by (eg) an id field, then subtracting the fields.

Say I have

tablea
----------
ida numa
----------
1 11
2 48
3 82
5 14


tableb
----------
idb numb
5 20
2 30
3 40
1 50


then if I execute:

SELECT ida, numa, numb, numa - numb AS sub
FROM tablea, tableb
WHERE tablea.ida = tableb.idb';

I'll get a result like:

ida numa numb sub
---------------------------
2 48 30 18
5 14 20 -6
3 82 40 42
1 11 50 -39

which is what I suspect you want. Note that the results do not appear in
any particular order.

If what you really want is a query that returns all records in the first
query EXCEPT those returned by the second query, then see:

http://www.postgresql.org/docs/8.3/static/queries-union.html

--
Craig Ringer

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

[GENERAL] deadlock debug methodology question

Hi All,
 
I have a deadlock situation, two transactions waiting on each other to complete. Based on the details below, would anyone have recommendations for me, please?
 
Regards,
 
A.
 
 
I am using:
rpm -qa|grep postgres
compat-postgresql-libs-4-2PGDG.rhel5_x86_64
postgresql-server-8.2.6-1PGDG.rhel5
postgresql-8.2.6-1PGDG.rhel5
postgresql-devel-8.2.6-1PGDG.rhel5
postgresql-libs-8.2.6-1PGDG.rhel5
 
I set 'deadlock_timeout = 1h' in order to have time to inspect pg_locks.

The locks are:
 
db0=# select * from pg_locks where not granted;
   locktype    | database | relation | page | tuple | transactionid | classid | objid | objsubid | transaction | pid  |   mode    | granted
---------------+----------+----------+------+-------+---------------+---------+-------+----------+-------------+------+-----------+---------
 transactionid |          |          |      |       |          1407 |         |       |          |        1404 | 8303 | ShareLock | f
 transactionid |          |          |      |       |          1404 |         |       |          |        1407 | 8277 | ShareLock | f
(2 rows)
 
Each transaction seems to be waiting on a row-level lock the other has acquired. The tuples are:
 
db0=# select * from pg_locks where locktype='tuple';
 locktype | database | relation | page | tuple | transactionid | classid | objid | objsubid | transaction | pid  |     mode      | granted
----------+----------+----------+------+-------+---------------+---------+-------+----------+-------------+------+---------------+---------
 tuple    |    16384 |    16576 |   38 |     6 |               |         |       |          |        1407 | 8277 | ExclusiveLock | t
 tuple    |    16384 |    16576 |   38 |     5 |               |         |       |          |        1404 | 8303 | ShareLock     | t
(2 rows)

The corresponding rows are:
 
db0=# select id from tt where ctid = '(38,6)';
 id 
-----
 600
(1 row)
db0=# select id from tt where ctid = '(38,5)';
 id 
-----
 611
(1 row)

Note that the id column is defined as 'id serial primary key'.
 
The two queries in effect in each transaction are found using:
 
select current_query from pg_stat_activity where procpid = 8303;
select current_query from pg_stat_activity where procpid = 8277;
 
Careful inspection of these (unfortunately complex) queries seems to indicate row-level locks are acquired in consistent order, assuming that any command of the type
 
update tt where ....
 
will always lock rows in a consistent order (can someone confirm that it is necessarily the case).

Therefore, it is not clear to me how this deadlock situation arises.

Does anyone have a recommendation?
 

Re: [SQL] Substract queries

Probably you are looking for EXCEPT.

SELECT * FROM Tbl1 WHERE a=1
EXCEPT
SELECT * FROM tbl2 WHERE a=1 and b=1;

http://www.postgresql.org/docs/8.3/interactive/sql-select.html

Regards,
Robins Tharakan

---------- Forwarded message ----------
From: Nacef LABIDI <nacef.l@gmail.com>
Date: Thu, May 22, 2008 at 8:45 PM
Subject: [SQL] Substract queries
To: pgsql-sql@postgresql.org


Hi all,

I was wondering how can I substract result between select queries. I mean I want to issue a query that does this :
(select * from mytable where condition1) - (select * from mytable where condition2)

Thanks to all

Nacef

[SQL] Substract queries

Hi all,

I was wondering how can I substract result between select queries. I mean I want to issue a query that does this :
(select * from mytable where condition1) - (select * from mytable where condition2)

Thanks to all

Nacef

Re: [pgsql-es-ayuda] execute

Hola Silvio,
Grande lo tuyo !!!
Saludos Cordiales

----- Original Message -----
From: "Silvio Quadri" <silvioq@gmail.com>
To: "Fernando Aguada" <fernandoaguada@yahoo.com.ar>
Sent: Thursday, May 22, 2008 11:50 AM
Subject: Re: [pgsql-es-ayuda] execute


> 2008/5/22 Fernando Aguada <fernandoaguada@yahoo.com.ar>:
>
>> Hola
>> hoy estoy renegando con todo lo que quiero hacer !.
>> Quiero implementar una funcion que ejecute un calculo "variable" y
>> estoy probando de implementarlo con un execute y no funciona, obviamente
>> hay algo
>> que execute no soporta y no se que es, el ejemplo es muy sencillo, para
>> ver
>> si funciona lo que quiero, y es el siguiente:
>>
>> declare wcmd varchar;
>> declare wcalc integer;
>> begin
>> wcmd:='if 1=1 then wcalc:=2*5; else wcalc:=10*10; end if;';
>>
>> raise notice 'valor % ',wcmd;
>> execute wcmd;
>>
>> return wcalc;
>> end
>>
>> Saludos.
>
>
> wcmd:='select case when 1=1 then 2*5 else 10*10 end';
> execute wcmd into wcalc;
>
>
> --
> Silvio Quadri
>

--
TIP 8: explain analyze es tu amigo

[pgadmin-hackers] SVN Commit by dpage: r7306 - trunk/www/download

Author: dpage

Date: 2008-05-22 15:59:14 +0100 (Thu, 22 May 2008)

New Revision: 7306

Revision summary: http://svn.pgadmin.org/cgi-bin/viewcvs.cgi/?rev=7306&view=rev

Log:
Note that the RPMs now live on the pgsqlrpms site.

Modified:
trunk/www/download/rpm.php

--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Re: [pgadmin-support] Installed pgadmin3-1.4.3 with 8.3.1 database..errors

On Thu, May 22, 2008 at 3:40 PM, Barbara Stephenson
<barbara@turbocorp.com> wrote:
> There isn't any other upgrade for redhat-4?

There are RPMs at http://yum.pgsqlrpms.org/ for a variety of platforms.

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com

--
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

[pgsql-es-ayuda] execute

a la lista

---------- Mensaje reenviado ----------
De: Silvio Quadri <silvioq@gmail.com>
Fecha: 22 de mayo de 2008 11:50
Asunto: Re: [pgsql-es-ayuda] execute
Para: Fernando Aguada <fernandoaguada@yahoo.com.ar>



2008/5/22 Fernando Aguada <fernandoaguada@yahoo.com.ar>:
Hola

       hoy estoy renegando con todo lo que quiero hacer !.
       Quiero implementar una funcion que ejecute un calculo "variable" y estoy probando  de implementarlo con un execute y no funciona, obviamente hay algo
que execute no soporta y no se que es, el ejemplo es muy sencillo, para ver si funciona lo que quiero, y es el siguiente:

declare wcmd varchar;
declare wcalc integer;
begin
    wcmd:='if 1=1 then wcalc:=2*5; else wcalc:=10*10; end if;';

   raise notice 'valor % ',wcmd;
   execute wcmd;

   return wcalc;
end

Saludos.

wcmd:='select case when 1=1 then 2*5 else 10*10 end';
execute wcmd into wcalc;


--
Silvio Quadri



--
Silvio Quadri

Re: [pgsql-es-ayuda] execute

EXECUTE es exclusivamente para sentencias sql, no para código arbitrario. En el nivel de código normal deberías poder expresar casi cualquier condición, quizás no necesites en realidad algo como lo que mencionas.

2008/5/22 Fernando Aguada <fernandoaguada@yahoo.com.ar>:
Hola
       hoy estoy renegando con todo lo que quiero hacer !.
       Quiero implementar una funcion que ejecute un calculo "variable" y estoy probando  de implementarlo con un execute y no funciona, obviamente hay algo
que execute no soporta y no se que es, el ejemplo es muy sencillo, para ver si funciona lo que quiero, y es el siguiente:

declare wcmd varchar;
declare wcalc integer;
begin
    wcmd:='if 1=1 then wcalc:=2*5; else wcalc:=10*10; end if;';

   raise notice 'valor % ',wcmd;
   execute wcmd;

   return wcalc;
end

Saludos.



Yahoo! Encuentros
Ahora encontrar pareja es mucho más fácil, probá el nuevo Yahoo! Encuentros.
Visitá http://yahoo.cupidovirtual.com/servlet/NewRegistration

[pgsql-es-ayuda] execute

Hola
       hoy estoy renegando con todo lo que quiero hacer !.
       Quiero implementar una funcion que ejecute un calculo "variable" y estoy probando  de implementarlo con un execute y no funciona, obviamente hay algo
que execute no soporta y no se que es, el ejemplo es muy sencillo, para ver si funciona lo que quiero, y es el siguiente:

declare wcmd varchar;
declare wcalc integer;
begin
    wcmd:='if 1=1 then wcalc:=2*5; else wcalc:=10*10; end if;';

   raise notice 'valor % ',wcmd;
   execute wcmd;

   return wcalc;
end

Saludos.



Yahoo! Encuentros
Ahora encontrar pareja es mucho más fácil, probá el nuevo Yahoo! Encuentros.
Visitá http://yahoo.cupidovirtual.com/servlet/NewRegistration

Re: [pgadmin-support] Installed pgadmin3-1.4.3 with 8.3.1 database..errors

On Thu, May 22, 2008 at 3:21 PM, Barbara Stephenson
<barbara@turbocorp.com> wrote:
> Hello,
>
> We have recently upgraded from 7.4.19 to 8.3.1. I am running Red Hat
> Enterprise Linux WS release 4 (Nahant Update 6) on my laptop and I finally
> was able to install pgadmin3-1.4.3. However, when I expand my databases, I
> get two popups. Does anyone know what that means?
>
>
> FIRST POPUP:
> An error has occured:
>
> ERROR: column op.oprlsortop does not exist
> LINE 12: LEFT OUTER JOIN pg_operator lso ON lso.oid=op.oprlsortop
>
> SECOND POPUP:
> An error has occured:
>
> ERROR: column "opcamid" does not exist
> LINE 3: JOIN pg_am am ON am.oid=opcamid

You need to upgrade pgAdmin. 1.4.3 is far too old to understand the
system catalogs in PG 8.3

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com

--
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

Re: [NOVICE] get id of insert in plpgsql function

Sorry, I found it.
mytable_pkey is not a sequence, it should be mytable_userid_seq.
But still, is there a way to get more clever error reports?


2008/5/22 A B <gentosaker@gmail.com>:
> I think I managed to get it working, but the error reporting is not so good,
>
> Here is the function (I removed some stuff to make it shorter)
>
> CREATE OR REPLACE FUNCTION addB(userid_ integer) RETURNS INTEGER AS $$
> DECLARE
> bibid INTEGER;
> BEGIN
> BEGIN
> INSERT INTO mytable (userid,y) VALUES (userid_,'f') RETURNING
> currval('mytable_pkey') into bibid;
> RETURN bibid;
> EXCEPTION WHEN OTHERS THEN /*Catch all*/
> RETURN 0;
> END;
> END;
> $$ LANGUAGE plpgsql;
>
> Now, I had forgot to add the column 'y' to mytable, and I got the error message
>
> ERROR: syntax error at or near "Resource" at character 1
> STATEMENT: Resource id #23
>
> in the pg_log/logfile
> Is there clever setting to get a better response?
>

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

[pgadmin-support] Installed pgadmin3-1.4.3 with 8.3.1 database..errors

Hello,

We have recently upgraded from 7.4.19 to 8.3.1.  I am running Red Hat
Enterprise Linux WS release 4 (Nahant Update 6) on my laptop and I finally
was able to install pgadmin3-1.4.3.  However, when I expand my databases, I
get two popups.  Does anyone know what that means?


FIRST POPUP:
An error has occured:

ERROR:  column op.oprlsortop does not exist
LINE 12:   LEFT OUTER JOIN pg_operator lso ON lso.oid=op.oprlsortop

SECOND POPUP:
An error has occured:

ERROR:  column "opcamid" does not exist
LINE 3:   JOIN pg_am am ON am.oid=opcamid

--
Regards,

Barbara Stephenson
EDI Specialist/Programmer
Turbo, division of Ozburn-Hessey Logistics
2251 Jesse Jewell Pkwy NE
Gainesville, GA 30507
tel: (678)989-3020 fax: (404)935-6171
barbara@turbocorp.com
www.ohlogistics.com

--
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

Re: [NOVICE] get id of insert in plpgsql function

I think I managed to get it working, but the error reporting is not so good,

Here is the function (I removed some stuff to make it shorter)

CREATE OR REPLACE FUNCTION addB(userid_ integer) RETURNS INTEGER AS $$
DECLARE
bibid INTEGER;
BEGIN
BEGIN
INSERT INTO mytable (userid,y) VALUES (userid_,'f') RETURNING
currval('mytable_pkey') into bibid;
RETURN bibid;
EXCEPTION WHEN OTHERS THEN /*Catch all*/
RETURN 0;
END;
END;
$$ LANGUAGE plpgsql;

Now, I had forgot to add the column 'y' to mytable, and I got the error message

ERROR: syntax error at or near "Resource" at character 1
STATEMENT: Resource id #23

in the pg_log/logfile
Is there clever setting to get a better response?

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

Re: [PERFORM] Index creation time and distribution

On Thu, 22 May 2008, Tom Lane wrote:
> Do you have maintenance_work_mem set large enough that the index
> creation sort is done in-memory? 8.1 depends on the platform's qsort
> and a lot of them are kinda pessimal for input like this.

Looking at the fact that other indexes on the same table are created
quickly, it seems that the maintenance_work_mem isn't the issue - the sort
algorithm is.

Having lots of elements the same value is a worst-case-scenario for a
naive quicksort. I am in the middle of testing sorting algorithms for a
performance lecture I'm going to give, and one of the best algorithms I
have seen yet is that used in Java's java.util.Arrays.sort(). I haven't
been able to beat it with any other comparison sort yet (although I have
beaten it with a bucket sort, but I wouldn't recommend such an algorithm
for a database).

From the JavaDoc:

> The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley
> and M. Douglas McIlroy's "Engineering a Sort Function",
> Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November
> 1993). This algorithm offers n*log(n) performance on many data sets that
> cause other quicksorts to degrade to quadratic performance.

Matthew

--
First law of computing: Anything can go wro
sig: Segmentation fault. core dumped.

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Re: [HACKERS] pg_dump roles support

Greetings,

* Stephen Frost (sfrost@snowman.net) wrote:
> Discussing psql options made me recall an annoying problem that we've
> run into. There's no way (unless it was added to 8.3 and I missed it,
> but I don't think so) to tell pg_dump 'switch to this role before
> doing anything else'. That's very frustrating when you use no-inherit
> roles for admins. eg:

I've looked into using PGOPTIONS to set the role, and it doesn't seem to
be possible because when we're processing the backend command-line
options we're not yet in a transaction state, so variable.c:assign_role
will always come back with NULL and you get:

vardamir:/home/sfrost> PGOPTIONS="-c role=postgres" psql -d networx -h vardamir
psql: FATAL: invalid value for parameter "role": "postgres"

In current CVS the relevant lines in variable.c are around 868. That's
my best guess as to what's happening anyway, I havn't had a chance to
actually hook up a debugger and trace it.

As I discuss above, it'd be really nice have a --role or similar option
to ask pg_dump to set role to a particular user before dumping the
database.

Thanks!

Stephen

[ADMIN] Error while executing pg_dump "invalid memory alloc request size 4294967293"

Hello  All,

We are using postgresql version 8.1 and our database size is 7gb. Ram Size is 2 GB. 

while trying to take backup through pg_dump i am getting following error.

oka97:  pg_dump amtdb > amtdb.out
pg_dump: ERROR:  invalid memory alloc request size 4294967293
pg_dump: SQL command to dump the contents of table "atbs2_logs" failed: PQendcopy() failed.
pg_dump: Error message from server: ERROR:  invalid memory alloc request size 4294967293
pg_dump: The command was: COPY public.atbs2_logs (sno, request_time, msisdn, phone_make, error_code, error_desc, reply_message, request_query, responce_time, request_type) TO stdout;


When I tried to take a single table backup i.e is mentioned in the error named "public.atbs2_logs"  then again getting following error.

pg_dump: SQL command failed
pg_dump: Error message from server: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
pg_dump: The command was: FETCH 100 FROM _pg_dump_cursor



So we are unable to take backup , we have tried the vacuum and reindex but not of any use.

Kindly help us Any help would be highly appreciate. Thanx in Advance.



Amit Jain

+91-9818450022






Re: [BUGS] error message "psql: expected authentication request from server, but received " when using psql to connect remote database

"TIAN Justin" <yongjuntian@alcatel-lucent.com> writes:
> Thanks for your quick response; the server we used is 8.1.4,
> The error when using client 8.1.4,
>> psql -U or -p 2222 -d testdb -h localhost
> Output:
> psql: expected authentication request from server, but received

What is in the server's pg_hba.conf file? I'm particularly wondering
what auth method is being selected ...

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Re: [NOVICE] recreating tables from global files

"G. J. Walsh" <gjwalsh@dscdirectionalservices.com> writes:
> I suffered a major server crash.
> Everything is fully reinstalled now EXCEPT postgresql8.3

> There was no way I could see to get postgres running except by
> removing /var/lib/pgsql/data. That was, I assumed, okay, because I have
> a full backup of all the files.

> So ... I reinstalled postgresql binaries following the same procedure as
> for the initial installation. I then restored the data/global files, but
> postgresql, while finding the database, sees no tables whatever.

You need the *entire* data directory tree, not just /global.

regards, tom lane

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

[GENERAL] Installed pgadmin3-1.4.3 with 8.3.1 database..errors

Hello,

We have recently upgraded from 7.4.19 to 8.3.1.  I am running Red Hat
Enterprise Linux WS release 4 (Nahant Update 6) on my laptop and I finally
was able to install pgadmin3-1.4.3.  However, when I expand my databases, I
get two popups.  Does anyone know what that means?


FIRST POPUP:
An error has occured:

ERROR:  column op.oprlsortop does not exist
LINE 12:   LEFT OUTER JOIN pg_operator lso ON lso.oid=op.oprlsortop

SECOND POPUP:
An error has occured:

ERROR:  column "opcamid" does not exist
LINE 3:   JOIN pg_am am ON am.oid=opcamid
--
Regards,

Barbara Stephenson
EDI Specialist/Programmer
Turbo, division of Ozburn-Hessey Logistics
2251 Jesse Jewell Pkwy NE
Gainesville, GA 30507
tel: (678)989-3020 fax: (404)935-6171
barbara@turbocorp.com
www.ohlogistics.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [PERFORM] Index creation time and distribution

On Thu, May 22, 2008 at 3:14 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Do you have maintenance_work_mem set large enough that the index
> creation sort is done in-memory? 8.1 depends on the platform's qsort
> and a lot of them are kinda pessimal for input like this.

FWIW, it's a 32 bits CentOS 4.6 box.

maintenance_work_mem is set to 256 MB and the size of the index is 400 MB.

Should I try to raise it up to 512 MB? The server only has 2GB of RAM
so it seems a bit high.

> 8.2 (which uses our own qsort) seems to perform better in a quick
> test.

Mmmmh OK. I was considering an upgrade to 8.3 in the next months anyway.

Do we agree that in the case of unnamed prepared statement, 8.3 plans
the query after the BIND? The partial index seems to be a better
solution anyway, considering that it's 12 MB vs 400 MB.

Thanks.

--
Guillaume

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Re: [HACKERS] proposal: table functions and plpgsql

2008/5/22 Hannu Krosing <hannu@krosing.net>:
> On Wed, 2008-05-21 at 23:06 +0200, Pavel Stehule wrote:
>> 2008/5/21 Hannu Krosing <hannu@krosing.net>:
>> > On Wed, 2008-05-21 at 13:31 -0400, Merlin Moncure wrote:
>> >> On Wed, May 21, 2008 at 1:28 PM, Hannu Krosing <hannu@krosing.net> wrote:
>> >> >> In my proposal I don't create any default variables. Result type is
>> >> >> only virtual - I don't need write it to system directory. I thing it's
>> >> >> better than using some specific predeclared type as RESULTTYPE OR
>> >> >> RESULTSET.
>> >> >
>> >> > How is this different from using OUT params and RETURNS SETOF RECORD ?
>> >>
>> >> *) you reference output variables via rowtype (r.var vs. var)
>> >
>> > As I'm currently working on updating another pl (pl/python), I'd like to
>> > know how will this affect get_call_result_type() defined in funcapi.h.
>> > will there be an extra parameter for record name there ?
>>
>> no
>
> why not ?
>
> do you think that other pl languages won't need it ?

no, I don't thing it. But I don't need to solve problem with
identifier colissions in external languages, because SQL is separated
from language. So there will not be changes for these languages.

I plan modify build_function_result_tupdesc_d function, but an changes
will not be visible from outside.

But there isn't any breaks to use this information (argmode) for pl
languages. Only I havn't any idea about it.

Regards
Pavel

>
> ---------------
> Hannu
>
>
>
>

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [NOVICE] recreating tables from global files

--- "G. J. Walsh" <gjwalsh@dscdirectionalservices.com> wrote:

> I suffered a major server crash.
>
> Everything is fully reinstalled now EXCEPT postgresql8.3
>
> There was no way I could see to get postgres running except by
> removing /var/lib/pgsql/data. That was, I assumed, okay,
> because I have
> a full backup of all the files.
>
> So ... I reinstalled postgresql binaries following the same
> procedure as
> for the initial installation. I then restored the data/global
> files, but
> postgresql, while finding the database, sees no tables
> whatever.
>
> I am sure there must be a way to recreate the tables from the
> files in
> the data/global directory but I don't know what that is.
> Further, of
> course, the files representing the tables are identified by
> numbers, not
> their table names.

I assume you already consulted the documentation:

http://www.postgresql.org/docs/8.3/interactive/backup.html

Bruce


--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

Re: [HACKERS] idea: storing view source in system catalogs

"Robert Haas" <robertmhaas@gmail.com> writes:
> I think the real problem here is that PostgreSQL is very finicky about
> what operations you can perform on a view. If I have a table foo and
> I define a view bar that uses foo and a view baz that uses bar, I can
> add a column to foo without a problem, and, similarly, I can also drop
> or alter a column in foo that is not used by bar. But the same is not
> true of bar.

Yeah. The current restrictions were set when CREATE OR REPLACE VIEW
was first implemented, and at that time we didn't have very much
ALTER TABLE capability at all; the view restrictions mirror what we
could do with a table at the time. It would be worth revisiting
that to make it square up with what you can now do to a table.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [pgsql-es-ayuda] Array variables y/o redimensionables

2008/5/22 Fernando Aguada <fernandoaguada@yahoo.com.ar>:
> Gracias amigos,
> ya encontre como declarar una array de longitud variable:

> declare warray numeric[];

> asi de simple !!!

Ok, gracias a ti...

> Saludos.
--
§~^Calabaza^~§ from Villa Elisa, Paraguay
--
TIP 10: no uses HTML en tu pregunta, seguro que quien responda no podrá leerlo

Re: [pgsql-es-ayuda] Array variables y/o redimensionables

Gracias amigos,
                         ya encontre como declarar una array de longitud variable:
                        declare warray  numeric[];

                       
asi de simple !!!

Saludos.



Yahoo! Deportes Beta
¡No te pierdas lo último sobre el torneo clausura 2008!
Enterate aquí http://deportes.yahoo.com

Re: [PERFORM] Index creation time and distribution

"Guillaume Smet" <guillaume.smet@gmail.com> writes:
> I experienced this morning a performance problem when we imported a
> dump in a 8.1 database.
> The table is 5 millions rows large and when the dump creates an index
> on a specific text column called clazz it takes 27 minutes while on
> the other columns, it only takes a couple of seconds:
> The only weird thing about this column is that 4.7 millions of rows
> have the exact same value.

Do you have maintenance_work_mem set large enough that the index
creation sort is done in-memory? 8.1 depends on the platform's qsort
and a lot of them are kinda pessimal for input like this.

8.2 (which uses our own qsort) seems to perform better in a quick
test.

regards, tom lane

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance