Monday, June 23, 2008

Re: [PATCHES] variadic function support

2008/6/24 Tom Lane <tgl@sss.pgh.pa.us>:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> But if I have
>> foo( a text, b int[])
>> it looks odd if both these calls are legal:
>> foo('a',1,2,3,)
>> foo('a',ARRAY[1,2,3])
>> which I understand would be the case with the current patch.
>
> Maybe I misunderstand what is supposed to happen, but I believe that
> if the function is marked VARIADIC then the second case would in fact
> be rejected: the signature of the function for parameter-matching
> purposes is text followed by one or more ints, never text and int[].
>
>> I'm also still curious to know how the following would be handled:
>> foo(a text[], b text[])
>
> I think a is just text[], full stop. Only the last parameter is
> interpreted differently for variadic.
>
> Your point about the syntax is good though. It would be better if
> the syntax were like
>
> create function foo (a text, variadic b int[])
>
> or maybe even better
>
> create function foo (a text, variadic b int)
>
> since (a) this makes it much more obvious to the reader what the
> function might match, and (b) it leaves the door open for marking
> multiple parameters as variadic, if we can figure out what that means.

(b) has one disadvantage - argument type is different than real
parameter - and internally it is little bit cleaner (doesn't need
changes in executor). So there is two forces in opposite. a) clean
function's declaration, b) clean function definition. This syntax is
limited - I am not able implement all cases of Oracle's decode
functions - but I hope it's good compromise between functionality and
simplicity.

note - variant b doesn't block multiple parameters as variadic - is
same case as a. array or not array is unimportant - I need different
types so I can choose what is first variadic argument and what is
second.

Academic question is using structured arrays - some like

create or replace function decode(s_value anyelement1, variadic
(s_value anyalement1, o_value anyelement)[])
returns anyelement as $$
select ($2[i]).o_value
from generate_subcripts($1,1) g(i)
where ($2[i]).s_value = $1;
$$ language sql;

regards
Pavel Stehule


>
> regards, tom lane
>

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

[pgus-board] OSCON prep

Good morning, all! While we're waiting for the lawyer to process the
new bylaws, a question: What do we need in place by OSCON? (We've
got various threads about promotional materials, etc., but I'd like to
tie in our thinking about OSCON, since we're now a month out.)

---Michael Brewer
mbrewer@gmail.com

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

[CYGWIN] why it is impossible to connect to the data base?

Dear all

I tried to connect my data base using a C++ program.

I use the following instructions  but it is impossible to make the connection.
Can someone explain me the problem.

 PGconn *conn;
 conn = PQsetdbLogin("localhost",
                     NULL,
                     NULL,
                     NULL,
                     "database",
                     "user",
                     "password");

Best regards



Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.

Re: [PATCHES] variadic function support

Pavel Stehule wrote:
> Hello
>
> this patch enhance current syntax of CREATE FUNCTION statement. It
> allows creating functions with variable number of arguments. This
> version is different than last my patches. It doesn't need patching
> PL. Basic idea is transformation of real arguments (related to
> declared variadic argument) to array. All changes are mostly in
> parser.
>
> Demo:
> CREATE FUNCTION public.least(double precision[]) RETURNS double precision AS $$
> SELECT min($1[i])
> FROM generate_subscripts($1,1) g(i)
> $$ LANGUAGE SQL VARIADIC;
>
> SELECT public.least(3,2,1);
> least
> -------
> 1
> (1 row)
>
> SELECT public.least(3,2,1,0,-1);
> least
> -------
> -1
> CREATE FUNCTION concat(varchar, anyarray) RETURNS varchar AS $$
> SELECT array_to_string($2, $1);
> $$ LANGUAGE SQL VARIADIC;
>
> SELECT concat('-',2008,10,12);
> concat
> ------------
> 2008-10-12
> (1 row)
>
>
>
>

And what about a function that takes 2 arrays as arguments?

This proposal strikes me as half-baked. Either we need proper and full
support for variadic functions, or we don't, but I don't think we need
syntactic sugar like the above (or maybe in this case it's really
syntactic saccharine).

cheers

andrew

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

Re: [NOVICE] table oids and comments

Mija Lee wrote:
>
> I think I'm a little confused about the something in the documentation:
>
> - I think table oids have been deprecated
> (http://www.postgresql.org/docs/8.2/interactive/runtime-config-compatible.html)
>
Use of OIDs in *user* tables is deprecated. OIDs *are* used by the
*system* tables.
> - It looks like the only way to retrieve the comments associated with
> a table is to use the function obj_descritption(object_oid,
> catalog_name).
> (http://www.postgresql.org/docs/8.2/interactive/functions-info.html#FUNCTIONS-INFO-COMMENT-TABLE)
>
>
These are system tables. You can leave OIDs set to off for user tables
and still have comments.

Cheers,
Steve


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

[GENERAL] Details on community survey

Regarding the community survey on the website: http://www.postgresql.org/community/

 

It would be great to have a little more detail about each of the TODO’s – what it means, what’s in scope, what’s out of scope, etc.

 

For example, PITR looks like a popular option, but there is already some PITR functionality in Postgres, so what would this TODO add?

 

Also, there was some talk previously about building a new log-based replication scheme, and I don’t see that on the list.  Why not?

 

Thanks!

 

--S

 

Re: [GENERAL] Timezone issue - Is it me or is this a massive bug?

Collin Peters escribió:
> I have read the post and understand the issue. I am wondering why
> this is not mentioned in the documentation. Or even worse why the
> PostgreSQL documentation explicitly lists all the timezones correctly
> in table B-4 http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-INPUT-TABLE
>
> In that table it has Melbourne, Australia as
> LIGT +10:00 Melbourne, Australia
>
> But according to the post you linked to that is not correct... I must
> instead specifiy -10:00. Should the documentation not note this?

Absolutely. Care to submit a patch?

--
Alvaro Herrera

http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

--
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] Timezone issue - Is it me or is this a massive bug?

I have read the post and understand the issue. I am wondering why
this is not mentioned in the documentation. Or even worse why the
PostgreSQL documentation explicitly lists all the timezones correctly
in table B-4 http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-INPUT-TABLE

In that table it has Melbourne, Australia as
LIGT +10:00 Melbourne, Australia

But according to the post you linked to that is not correct... I must
instead specifiy -10:00. Should the documentation not note this?

On Sat, Jun 21, 2008 at 9:54 AM, Adrian Klaver <aklaver@comcast.net> wrote:
> On Friday 20 June 2008 1:19 pm, Collin Peters wrote:
>> I have a server of which the OS timezone is set to Pacific time
>> (currently -7). I run the following query on it
>>
>> SELECT now(), now() AT TIME ZONE 'GMT+10:00', now() AT TIME ZONE
>> 'GMT-10:00', now() AT TIME ZONE 'Australia/Melbourne'
>>
>> I would expect this to return:
>> * column 1 - the current time in the pacific (-7) - "2008-06-20
>> 13:09:39.245641-07"
>> * column 2 - the GMT +10 - "2008-06-21 06:09:39.245641"
>> * column 3 - the GMT -10 - "2008-06-20 10:09:39.245641"
>> * column 4 - the current time in Melbourne Australia - "2008-06-21
>> 06:09:39.245641"
>>
>> Instead it returns:
>> * column 1 - the current time in the pacific (-7) ("2008-06-20
>> 13:09:39.245641-07" - CORRECT)
>> * column 2 - the current time MINUS 10 ("2008-06-20 10:09:39.245641" -
>> WRONG) * column 3 - the current time PLUS 10 ("2008-06-21 06:09:39.245641"
>> - WRONG) * column 4 - the current time in Melbourne Australia ("2008-06-21
>> 06:09:39.245641" - CORRECT)
>>
>>
>> Am I missing something obvious? Seems when I specify GMT+10:00 it
>> returns GMT-10:00 and vice versa. Note that column 2 & 3 are
>> timestamp withOUT timezone while 1 & 4 are timestamp WITH timezone.
>> But I still see this as totally wrong.
>>
>> Regards,
>> Collin Peters
>
> See this message for the explanation:
> http://archives.postgresql.org/pgsql-bugs/2008-04/msg00077.php
> --
> Adrian Klaver
> aklaver@comcast.net
>

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

Re: [pgsql-es-ayuda] Duda en necesidad de bloquear tablas

Jaime Casanova escribió:
> 2008/6/21 Arturo <arturomunive@gmail.com>:
>
>>>> Ahora que he dormido un poco pensaba, podria poner uan columna en la
>>>> compra,
>>>> un booleano quiza que se llame en_proceso
>>>> y que cuando voy a ejecutar el pago o transaccion lo primero que haga es
>>>> marcarla (y hacer un commit) luego ya puedo procesar tranquilo en mi
>>>> transaccion normal.
>>>>

>>>> si haces un SELECT ... FOR UPDATE en la tabla de compras, si alguien
>>>> desea insertar un pago no tendra que intentar bloquear los registros
>>>> en la tabla de compras? pero como los registros estaran bloqueados no
>>>> podra hasta que sueltes el bloqueo en la tabla de compras, solo
>>>> entonces podra seguir procesando su insercion y para entonces tu
>>>> transacion ya habra hecho COMMIT o ROLLBACK... en esencia es lo mismo
>>>> que tu campo "en_proceso" pero con bloqueos y sin datos de que
>>>> preocuparse..
Ya entendí, no se que me paso lei la documentacion de SELECT FOR UPDATE
pero no había caido en cuenta que era lo mismo.
si el pago es para una compra digamos con id = 7
entonces puedo hacer un

SELECT ...FROM compras WHERE id = 7 FOR UPDATE

Entonces cuando otro procedimiento quiera ejecutar un pago a la misma
compra tendría que basicamente ejecutar la misma sentencia (como tu
mencionas)
SELECT ...FROM compras WHERE id = 7 FOR UPDATE

Entonces tendra que esperar (A menos que use NOWAIT) y asi me aseguro no
hacer un bloqueo a nivel de tabla si no a nivel de filas, ganando en
performance
ya que pagos para otras compras no se bloquearian.
Además, otra razon por la cual es correcto el select for update en la
compra, es que al final la puedo marcar como pagada (un update).

Gracias Jaime con eso doy contestada mi pregunta.la respueta estaba en
SELECT FOR UPDATE


--
---------------------------------------------------------
ARTURO MUNIVE SOLIS
Telefono: (51-54)424701
Celular : (51-54)959992034
[Desarrollo De Soluciones Java-PostgreSQL Arequipa-Perú]

--
TIP 9: visita nuestro canal de IRC #postgresql-es en irc.freenode.net

Re: [pgsql-es-ayuda] De Oracle Forms y PL/PSQL a PostgreSQL

Hola, gracias por sus recomendaciones.

Como les comenté en un principio, no es mucha la información que manejaba sobre esto. Ya por lo que veo, lo de Oracle Forms es algo más tipo front-end para el postgres. Con respecto al pl/sql -> pl/pgsql me pondré a revisar cuáles son los posibles conflictos que existan entre estos.

Seguiré evaluando y revisando información acerca de esto y cualquier avance lo haré saber por este mismo thread.

Saludos, Luis Garcia.

PD: anexo un correo que me envió Nicola Strappazzon en respuesta a mi pregunta, pero que olvidó copiar a la lista.

El día 22 de junio de 2008 23:51, Nicola Strappazzon <nicola51980@gmail.com> escribió:
Hola Luis, yo hace tiempo vi una herramienta para hacer formularios y de mas conectándose con PostgreSQL, prueba a ver si esto llena tus expectativas:

http://www.glom.org




--
Luis D. García M.

Telf: (+58) 2418662663
Cel.: (+58) 4143482018

Re: [pgsql-es-ayuda] instalar tsearch

2008/6/23 Gabriel Ferro <gabrielrferro@yahoo.com.ar>:
> Tengo la version "PostgreSQL 8.2.5 on i686-pc-mingw32, compiled by GCC
> gcc.exe (GCC) 3.4.2 (mingw-special)" en un ubuntu server
>
> ¿como puedo instalarla sin meter la pata y borrar algo de postgre?
>
> tengo este paso
>
> pt-get install postgresql-contrib-8.1
>

si tienes postgres 8.2 deberian instalar los contrib del 8.2 no del 8.1


--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Guayaquil - Ecuador
Cel. (593) 87171157
--
TIP 5: ¿Has leído nuestro extenso FAQ?

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

Re: [BUGS] Abnormal termination of PostgreSQL

Tom Lane wrote:
> If you have the time and interest, it might be worth repeating the
> whole setup sequence starting from initdb. I'm speculating that
> installing PostGIS might have somehow left corruption in server memory
> that later manifested as the visible problem.
>

Tom,

I'm not sure if I did this right, but a rebuild of that data cluster
worked fine. Here's the steps I took (please correct me if I messed
something up here):

I stopped the server, then just deleted /usr/local/pgsql/data, followed by:

# su - postgres
$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

Then I updated pg_hba.conf to the correct access settings, and started
the postmaster service again.

Following that I logged into psql and set a password for postgres and
created a lower-privileged user account (bthoen) to use with the
database I will be building (vfm).

Then I created the database and "spatialized" it.
$ createdb -O bthoen vfm
$ createlang plpgsql vfm
$ psql -f /usr/local/pgsql/share/lwpostgis.sql -d vfm

Finally I created the corn0715 table and populated it, ran my update
script and indexed the table. Finally I did a 'vacuum full' on it to
pack it back down.

The table seems fine this time, and there was no segfaulting nonsense at
any time. But the server log was a lot more active. Whe I loaded this
data the first time and had that corruption prroblem, there was hardly
anything posted to the log. However, this time I noticed when I ran the
postgis script that there was some weirdness written to the log that
doesn't look right . Does this look like geos or postgis is a bit broken
to you?

NOTICE: type "histogram2d" is not yet defined
DETAIL: Creating a shell type definition.
NOTICE: return type histogram2d is only a shell
NOTICE: argument type histogram2d is only a shell
NOTICE: argument type histogram2d is only a shell
NOTICE: type "spheroid" is not yet defined
DETAIL: Creating a shell type definition.
NOTICE: return type spheroid is only a shell
NOTICE: argument type spheroid is only a shell
NOTICE: argument type spheroid is only a shell
NOTICE: type "geometry" is not yet defined
DETAIL: Creating a shell type definition.
NOTICE: return type geometry is only a shell
NOTICE: argument type geometry is only a shell
NOTICE: argument type geometry is only a shell
NOTICE: return type geometry is only a shell
NOTICE: return type geometry is only a shell
NOTICE: argument type geometry is only a shell
NOTICE: argument type geometry is only a shell
NOTICE: type "box3d" is not yet definedDETAIL: Creating a shell type
definition.
NOTICE: argument type box3d is only a shell
NOTICE: return type box3d is only a shell
NOTICE: argument type box3d is only a shell
NOTICE: type "chip" is not yet defined
DETAIL: Creating a shell type definition.
NOTICE: return type chip is only a shell
NOTICE: argument type chip is only a shell
NOTICE: argument type chip is only a shell
NOTICE: type "box2d" is not yet defined
DETAIL: Creating a shell type definition.
NOTICE: return type box2d is only a shell
NOTICE: argument type box2d is only a shell
NOTICE: argument type box2d is only a shell
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"spatial_ref_sys_pkey" for table "spatial_ref_sys"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"geometry_columns_pk" for table "geometry_columns"
ERROR: table "corn0715" does not exist
STATEMENT: drop table corn0715 ;
LOG: checkpoints are occurring too frequently (25 seconds apart)
HINT: Consider increasing the configuration parameter
"checkpoint_segments".
LOG: checkpoints are occurring too frequently (25 seconds apart)
HINT: Consider increasing the configuration parameter
"checkpoint_segments".
. . .

(lots of checkpoints static with the COPY loading, but otherwise things
looked normal from here on.)

So I think postgres is all right, but I'm not so sure about postgis. I
did have problems trying to compile GEOS (and GDAL) so maybe that's
where the trouble lies.

Any thoughts?

- Bill Thoen


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

Re: [pgsql-es-ayuda] instalar tsearch

--- El lun 23-jun-08, Gabriel Ferro <gabrielrferro@yahoo.com.ar> escribió:
De: Gabriel Ferro <gabrielrferro@yahoo.com.ar>
Asunto: [pgsql-es-ayuda] instalar tsearch
A: pgsql-es-ayuda@postgresql.org
Fecha: lunes, 23 junio, 2008, 11:36 am

Maestros siguiendo sus consejos voy a investigar el tema del tsearch2, a cosa es que en el server  no tengo instalado ningun paquete contrib (creo al menos no la enontre y en las base de datos no aparecen las funciones del tsearch).
Tengo la version "PostgreSQL 8.2.5 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2 (mingw-special)" en un ubuntu server

¿como puedo instalarla sin meter la pata y borrar algo de postgre?

tengo este paso

pt-get install postgresql-contrib-8.1

>>con esto instalas los CONTRIB de postgresql pero no se inicializa el tsearch2, en la base de datos
y este otro
tar -zxvf tsearch-v2.tar.gz
mv tsearch2 $PGSQL_SRC/contrib/
cd $PGSQL_SRC/contrib/tsearch2
gmake
gmake install
gmake installcheck

>> este es el paso que te permitira usar tsearch2 en tu base de datos
Cual me recomiendan ?

>> si no tiene los contrib instalalos y realiza el make luego de instalar el contrib


¡Buscá desde tu celular! Yahoo! oneSEARCH ahora está en Claro
http://ar.mobile.yahoo.com/onesearch

[pgsql-es-ayuda] instalar tsearch

Maestros siguiendo sus consejos voy a investigar el tema del tsearch2, a cosa es que en el server  no tengo instalado ningun paquete contrib (creo al menos no la enontre y en las base de datos no aparecen las funciones del tsearch).
Tengo la version "PostgreSQL 8.2.5 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2 (mingw-special)" en un ubuntu server

¿como puedo instalarla sin meter la pata y borrar algo de postgre?

tengo este paso

pt-get install postgresql-contrib-8.1
y este otro
tar -zxvf tsearch-v2.tar.gz
mv tsearch2 $PGSQL_SRC/contrib/
cd $PGSQL_SRC/contrib/tsearch2
gmake
gmake install
gmake installcheck
Cual me recomiendan ?





¡Buscá desde tu celular! Yahoo! oneSEARCH ahora está en Claro
http://ar.mobile.yahoo.com/onesearch

Re: [GENERAL] Forcibly vacating locks

>> > >> 2) Is there any hostility about the notion of implementing this feature
>> > >> into Postgres?
>> > >
>> > > Probabably --- it seems like a narrow use case.
>> >
>> > I'll consider this to be the definite answer unless I hear a dissenting
>> > opinion in the next few days.
>>
>> Yea, I might be wrong.
>
> I think you're very right. Don't ever want to see locks disappearing
> because of a timeout, sorry Laurent.
>

OK, thanks all for the replies.

Laurent Birtz

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

[pgadmin-hackers] Option req.: Save query result in file

Hi,

it'd be nice to be able to stuff the output of a select into a textfile
as csv or even something that copes decently with carriage returns
within text-collums like xls or odf.

Even csv with escaped (CR LF) and (LF) would be great.


regards

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

Re: [GENERAL] Forcibly vacating locks

On Fri, 2008-06-20 at 18:38 -0400, Bruce Momjian wrote:
> Laurent Birtz wrote:
> > > No. The closest thing we have is log_lock_waits in 8.3. I wonder if
> > > you could hack up something to monitor the server logs for such messages
> > > and cancel the queries.
> >
> > Assuming I can monitor the logs in this way, how would I cancel the
> > queries (or lack thereof, in the case of a client that sits doing nothing
> > with a held lock)?
>
> Use log_line_prefix to get the process id in the log line, then use
> pg_cancel_backend() on the process id.
>
> > >> 2) Is there any hostility about the notion of implementing this feature
> > >> into Postgres?
> > >
> > > Probabably --- it seems like a narrow use case.
> >
> > I'll consider this to be the definite answer unless I hear a dissenting
> > opinion in the next few days.
>
> Yea, I might be wrong.

I think you're very right. Don't ever want to see locks disappearing
because of a timeout, sorry Laurent.

--
Simon Riggs

www.2ndQuadrant.com

PostgreSQL Training, Services and Support


--
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] Importing undelimited files (Flat Files or Fixed-Length records)

Patrick TJ McPhee wrote:
> In article <485AE3AA.3030700@gisnet.com>, Bill Thoen <bthoen@gisnet.com> wrote:
> % I've got to load some large fixed-legnth ASCII records into PG and I was
> % wondering how this is done. The Copy command looks like it works only
> % with delimited files, and I would hate to have to convert these files to
> % INSERT-type SQL to run them through psql.. Is there a way one can
> % specify a table structure with raw field widths and then just pass it a
> % flat file?
>
> pg_loader is supposed to handle this.
>
> http://pgfoundry.org/projects/pgloader
>
>

Thanks, but as it turned out I also had to skip blank lines, so I wrote
a short sed script and piped the data through that into COPY. That
worked just fine.

--
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] Postgresql is very slow

Hi,

> Hello to list,
>
> We have a CentOS-5 server with postgresql-8.1.8 installed. I am struggling
> with postgresql performance. Any query say select * from tablename takes
> 10-15 mins to give the output, and while executing the query system loads
> goes up like anything. After the query output, system loads starts
> decresing.

I doubt the 'select * from tablename' is a good candidate for tuning, but
give us more information about the table. What is it's size - how many
rows does it have and how much space does it occupy on the disk? What is a
typical usage of the table - is it modified (update / delete) frequently?
How is it maintained - is there a autovacuum running, or did you set a
routine vacuum (and analyze) job to maintain the database?

I guess one of the servers (the slow one) is running for a long time
without a proper db maintenance (vacuum / analyze) and you dumped / loaded
the db onto a new server. So the 'new server' has much more 'compact'
tables and thus gives the responses much faster. And this holds for more
complicated queries (with indexes etc) too.

An output from 'EXPLAIN' (or 'EXPLAIN ANALYZE') command would give a much
better overview.

Tomas


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

Re: [CYGWIN] Cygwin and postgresql connexion

Without compile or link errors, it sounds like your program is simply crashing (segmentation fault?). Try running it in a debugger like gdb.

Are you able to compile and run the test programs provided with libpq++?

Curran

-----Original Message-----
From: pgsql-cygwin-owner@postgresql.org [mailto:pgsql-cygwin-owner@postgresql.org] On Behalf Of BELEM Mahamadou
Sent: Monday, June 23, 2008 9:23 AM
To: pgsql-cygwin@postgresql.org
Subject: [CYGWIN] Cygwin and postgresql connexion

Dear all

I am a new user of Postgresql.

I try to connect to a data base using à C++ program. Then, I import libpq-fe.h.

By when I compile my program no error occurs but it is impossible to run the program.
The program stop wothout error during the execution. I use cygwin.

Someone can explain me the problem?

Now I want to use liqpq++ but I don't know how to import this library using cygwin.

I notice that I am using cygwin


Best regard

________________________________

Envoyé avec Yahoo! Mail <http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52423/*http://fr.docs.yahoo.com/mail/overview/index.html> .
Une boite mail plus intelligente.

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

Re: [PERFORM] Postgresql is very slow

bijayant kumar wrote:
> select * from tablename takes 10-15 mins to give the output


There are better ways to dump data than using a database; that's
not a useful query.


> Any query select,insert,update simple or complex behaves in the same way

Have you set up suitable indexes for your operations (and then run analyze)?

Cheers,
Jeremy

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

[CYGWIN] Cygwin and postgresql connexion

Dear all

I am a new user of Postgresql.

I try to connect to  a data base using à C++ program. Then, I import libpq-fe.h.

By when I compile my program no error occurs but it is impossible to run the program.
The program stop wothout error during the execution. I use cygwin.

Someone can explain me the problem?

Now I want to use liqpq++ but I don't know how to import this library using cygwin.

I notice that I am using cygwin


Best regard
 



Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.

[COMMITTERS] npgsql - Npgsql2: NpgsqlConnection.State only returns Open or Closed.

Log Message:
-----------
NpgsqlConnection.State only returns Open or Closed. FullState returns Or'd version.

Modified Files:
--------------
Npgsql2/src/Npgsql:
NpgsqlConnection.cs (r1.21 -> r1.22)
(http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/npgsql/Npgsql2/src/Npgsql/NpgsqlConnection.cs.diff?r1=1.21&r2=1.22)
NpgsqlTransactionCallbacks.cs (r1.5 -> r1.6)
(http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/npgsql/Npgsql2/src/Npgsql/NpgsqlTransactionCallbacks.cs.diff?r1=1.5&r2=1.6)

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

Re: [HACKERS] pg_stat_statements

On Mon, 2008-06-23 at 15:22 +0900, ITAGAKI Takahiro wrote:
> I wrote:
> > I will try to measure overheads of logging in some implementation:
> > 1. Log statements and dump them into server logs.
> > 2. Log statements and filter them before to be written.
> > 3. Store statements in shared memory.
> > I know 1 is slow, but I don't know what part of it is really slow;
>
> I tested overheads of SQL logging with pgbench.
> $ pgbench -s10 -c10 -t10000 -n -S -M prepared
>
> logging type | tps | %
> -----------------------+-------+--------
> 0. no logging | 10651 | 100.0%
> 1. log to pg_log/* | 6535 | 61.4%
> 2. log to /dev/null | 8347 | 78.4%
> 3. store in memory | 10280 | 96.5%
>
> As expected, 1 is 40% slower than no logging settings. Also, filtering
> logs before written into files seems not to be a perfect solution.
> Redirecting logs to /dev/null is the *fastest* filter, but there was
> 30% of overhead. On the other hand, 3 has only 3.5% of overhead.
>
> I think storing SQLs in server memory is worth trying even if there
> are some troubles, for example, memory management. We can use either
> hooks and dtrace for the purpose, but I'm working hook-method because
> of portability.
>
> I'll send a core patch and an extension module to -patches. I hope only
> the patch is to be applied in the core. The extension module would be
> better to be developed separately from the core.

I think you want to see the distribution of execution times for
particular queries without needing to log *every* execution, including
parameters. I think I understand now what you are asking for and why you
are asking for it.

How about we have another log mode, call it log_statement_summary where
we keep track of the running average of re-execution time of each
protocol 3 prepared plan. Once we have 40 executions for a plan we log
any statement, with parameters, that has an execution time more than
twice the running average. That way we have an automatic filter to
reduce the amount of logging, yet without changing any current tuning
methodologies or tools.

We could also have a function that causes each backend to dump the
current averages of all plans through to the stats collector, so you can
assemble a global view. But that should be on-demand, not a continuous
flow of stats, IMHO.

I'd been thinking about ways to specify "desired execution time" for any
query, so we could log only those queries that aren't performing as
expected.

Yes, doing this as a plugin makes a lot of sense for me.

--
Simon Riggs

www.2ndQuadrant.com

PostgreSQL Training, Services and Support


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

[CYGWIN] problem of cygwin and progresql coupling


 Dear all

I am a new user of Postgresql with C++..

I try to connect to  a data base using à C++ program. Then, I import libpq-fe.h.

By when I compile my program no error occurs but it is impossible to run the program.
The program stop wothout error during the execution. I use cygwin.

Someone can explain me the problem?

Now I want to use liqpq++ but I don't know to import this library using cygwin.

I notice that I am using cygwin


Best regard



Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.

[PATCHES] variadic function support

Hello

this patch enhance current syntax of CREATE FUNCTION statement. It
allows creating functions with variable number of arguments. This
version is different than last my patches. It doesn't need patching
PL. Basic idea is transformation of real arguments (related to
declared variadic argument) to array. All changes are mostly in
parser.

Demo:
CREATE FUNCTION public.least(double precision[]) RETURNS double precision AS $$
SELECT min($1[i])
FROM generate_subscripts($1,1) g(i)
$$ LANGUAGE SQL VARIADIC;

SELECT public.least(3,2,1);
least
-------
1
(1 row)

SELECT public.least(3,2,1,0,-1);
least
-------
-1
CREATE FUNCTION concat(varchar, anyarray) RETURNS varchar AS $$
SELECT array_to_string($2, $1);
$$ LANGUAGE SQL VARIADIC;

SELECT concat('-',2008,10,12);
concat
------------
2008-10-12
(1 row)


Regards
Pavel Stehule

Re: [pgsql-es-ayuda] Ayuda con una funcion SQL

No te sirve un UNION ALL?
SELECT * FROM rs_tabla_1 UNION ALL SELECT * FROM rs_tabla_2

2008/6/20 Juan Carlos Badillo Goy <badillo@cav.desoft.cu>:

Ahora estoy tratando de hacer que una función me retorne lo siguiente: (la
suma o union por asi decirlo de rs_tabla_1 y rs_tabla_2 )

CREATE OR REPLACE FUNCTION "public"."funct_resultante" (aid_usuario integer)
RETURNS SETOF "public"."tabla_1" AS
$body$
declare rs_tabla_1 tabla_1%rowtype;
declare rs_tabla_2 tabla_1%rowtype;
begin

       for rs_tabla_1 in
           select * from rs_tabla_1 where propietario = aid_usuario and
(tipo = 2 or tipo = 7)
       loop
           return next rs_tabla_1;
       end loop;

       for rs_tabla_2 in
           select * from rs_tabla_2 where propietario = aid_usuario and tipo
= 9
       loop
           return next rs_tabla_2;
       end loop;

  return;
end;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;




--
Informático:
Persona falta de recursos que, partiendo de premisas falsas y de especificaciones inconsistentes e incompletas, dirigido por incompetentes y utilizando herramientas que no funcionan es capaz de iniciar un proyecto de dudoso éxito realizando una obra de arte que ,por supuesto, es cara y no tiene otro fin que dar prestigio a la empresa que ha contratado sus servicios.
http://islamanzana.es/desarrollo-de-software/definicion-de-informatico

Re: [pgsql-es-ayuda] RE: [pgsql-es-ayuda] Problemas con las ñ y las tildes

También has de tener en cuenta que si estás ingresando los datos via web, tenes que especificar el charset correspondiente tanto para que se muestren como para que ingresen a la base de datos.
http://www.w3.org/International/O-charset
Ya que es posible que los estés viendo mal pero en la base de datos estén correctamente guardados.

El día 23 de junio de 2008 5:43, Gorka <gorkapostgres@yahoo.es> escribió:
>Hola a todos, tengo un problema con las tildes y la ñ y es que no las
reconoce. Alguien podría decirme si existe alguna configuración especial de
>postgresql para esto.
>Gracias de antemano.

Hola Adrian. Yo tuve el mismo problema y lo solucioné creando la base de
datos con el encoding preciso.

Haz un psql -l y mira el encoding que tiene template1, por ejemplo. Pues ese
has de usar. Para castellano me he encontrado que los más habituales son
'LATIN1', 'LATIN9' y 'UTF8'. Pongamos que el tuyo (el que viste en
template1) es 'LATIN1', pues tendrás que crear la base de datos de esta
forma ...

=> create database nombrebase with encoding = 'UTF8';

.... antes de ejecutar tu script personal con el que supongo que cargas tu
estructura y datos particulares.

Espero haber ayudado, no soy ningún experto, como puedes ver.



--
TIP 4: No hagas 'kill -9' a postmaster



--
Informático:
Persona falta de recursos que, partiendo de premisas falsas y de especificaciones inconsistentes e incompletas, dirigido por incompetentes y utilizando herramientas que no funcionan es capaz de iniciar un proyecto de dudoso éxito realizando una obra de arte que ,por supuesto, es cara y no tiene otro fin que dar prestigio a la empresa que ha contratado sus servicios.
http://islamanzana.es/desarrollo-de-software/definicion-de-informatico

Re: [PERFORM] Postgresql is very slow

On Monday 23 June 2008 07:06:54 bijayant kumar wrote:
> Hello to list,
>
> We have a CentOS-5 server with postgresql-8.1.8 installed. I am struggling
> with postgresql performance. Any query say select * from tablename takes
> 10-15 mins to give the output, and while executing the query system loads
> goes up like anything. After the query output, system loads starts
> decresing.

Sounds like a vacuum problem.

>
> Any query select,insert,update simple or complex behaves in the same way,
> what i have explained above.
>
> System Specification:
>
> OS :- CentOs 5
> Postgresql 8.1.8
> RAM :- 1 GB
> SWAP 2 GB
>
> Some relevent part(uncommented) of my /var/lib/pgsql/data/postgresql.conf
>
> listen_addresses = 'localhost'
> max_connections = 100
> shared_buffers = 1000

You shared_buffers seems low.

>
> The one more strange thing is that with the same setting on another server,
> postgresql is running very smooth. I had run vacum also some times back.

You are aware that vacuum is supposed to be an ongoing maintenance activity,
right?

>
> Please help me out and let me know if you need any other information.
>
> Thanks & Regards,
>
> Bijayant Kumar
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com

jan

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

Re: [ADMIN] vacuumdb not enough stack items

Decibel! <decibel@decibel.org> a écrit :

> On Jun 21, 2008, at 8:47 AM, hjeancha@freesurf.fr wrote:
>> i use postgresql version7.4.7 on i386-pc-linux-gnu, autovacuum is
>> configured to run on this database.
>> But recently, we lost data for a database, we were able to connect
>> the database but we couldn't see any table anymore.
>> I suspected a transaction ID wraparound, and to fix it, i just
>> imported data from a dump file.
>> I tried to execute the following query:
>> SELECT datname, age(datfrozenxid) FROM pg_database where age
>> (datfrozenxid)<0;
>> template1=# SELECT datname, age(datfrozenxid) FROM pg_database
>> where age(datfrozenxid)<0;
>> datname | age
>> ------------------------------------------+-------------
>> template0 | -597653514
>> ez_info1 | -205024652
>> XtDB | -205024658
>>
>>
>> Does the negative value of age means that a transaction ID
>> wraparound has already occured?
>
> That would be my guess.
>
>> Doing a manual vacuumdb on each database raise an error message saying:
>> vacuumdb: vacuuming of database "ez_info1" failed: ERREUR: not
>> enough stack items
>
> That's probably a bug in vacuum, but even so, you'll want to re-
> initdb if you want to just pull back in from a pg_dump.
>
> If you can take the downtime to do a pg_dump/restore, you should
> really upgrade to a more recent version. You'll get integrated
> autovacuum and code that makes wraparound impossible. I would not
> expect you to have any major code issues going to 8.0 or 8.1. Of
> course going to 8.3 would be better, but you could run into some
> compatibility issues. You'll get a performance gain to boot.
> --
> Decibel!, aka Jim C. Nasby, Database Architect decibel@decibel.org
> Give your computer some brain candy! www.distributed.net Team #1828
>
>
>

Hello,

We plan to upgrade to postgresql release 8.1 very soon.
But for now, i found that there is a problem with vacuum.
Doing a vaccuum verbose analyze manually on a database,
we got the error "primary keys constraint broken by duplicate key
«pg_statistic_relid_att_index».
As suggested on this list it's seems to be an index problem.
That could explain why we got "transaction wraparound" for some databases that
were never really vacuumed because of duplicate key error in
«pg_statistic_relid_att_index».
I red to solve this problem, one must "delete from pg_statistic" then
reindex database.
I just want to know:

1) if it's safe to do this, because data is still accessible even for
databases with transaction wraparound xid.
If This can fix the «pg_statistic_relid_att_index», i will be able to
vacuum cleanly every databases.

2)
The age(datfrozenxid) for other databases are
ez_modele | 1074290700
ez_modele2 | 1074290002
Does that means, if there are not a lot of transactions, transaction
wraparound xid won't happen until reaching the limit of 2 billions
transactions.


Thank you,


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

Re: [pgsql-www] Archives broken by new mail VM?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Should be fixed ... missed starting rsync --daemon and switchihg mail to point
to the new VPS ...

I can't find where the sync process is kicked off though, so either someone
else will have to do that, or just wait fo rit to kick off on its own ...

- --On Monday, June 23, 2008 13:21:56 +0200 Magnus Hagander
<magnus@hagander.net>
wrote:

> Seems we don't get anything into the archives anymore, and the search
> system is sending out alarms because it's not finding anything My first
> guess is that it's somehow related to the move of the VM. Can somebody
> who knows anything about this new VM (hello Marc) please look into that
> ASAP? Thanks!
>
> //Magnus

- --
Marc G. Fournier Hub.Org Hosting Solutions S.A. (http://www.hub.org)
Email . scrappy@hub.org MSN . scrappy@hub.org
Yahoo . yscrappy Skype: hub.org ICQ . 7615664
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEARECAAYFAkhfjHUACgkQ4QvfyHIvDvOcKwCfUBuER8yPbPx45oie2y7CnZUE
/X4AoI1zT+B9ZObzH+P4xgL7ZWf38zcN
=z9M4
-----END PGP SIGNATURE-----


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

[pgsql-www] Archives broken by new mail VM?

Seems we don't get anything into the archives anymore, and the search
system is sending out alarms because it's not finding anything My first
guess is that it's somehow related to the move of the VM. Can somebody
who knows anything about this new VM (hello Marc) please look into that
ASAP? Thanks!

//Magnus

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

[PERFORM] Postgresql is very slow

Hello to list,

We have a CentOS-5 server with postgresql-8.1.8 installed. I am struggling with postgresql performance. Any query say select * from tablename takes 10-15 mins to give the output, and while executing the query system loads goes up like anything. After the query output, system loads starts decresing.

Any query select,insert,update simple or complex behaves in the same way, what i have explained above.

System Specification:

OS :- CentOs 5
Postgresql 8.1.8
RAM :- 1 GB
SWAP 2 GB

Some relevent part(uncommented) of my /var/lib/pgsql/data/postgresql.conf

listen_addresses = 'localhost'
max_connections = 100
shared_buffers = 1000

The one more strange thing is that with the same setting on another server, postgresql is running very smooth. I had run vacum also some times back.

Please help me out and let me know if you need any other information.

Thanks & Regards,

Bijayant Kumar

Send instant messages to your online friends http://uk.messenger.yahoo.com

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

[pgsql-www] Revised downloads section on the website

[CC'd to -www]
 
Packagers,
 
I have committed changes to the PostgreSQL website as part of a larger strategy to make things easier for new users. The changes to the website are intended to make it much easier for the newbie to find and install the required components for their OS. I've written up very basic instructions for most of the OSs we package for - I'd appreciate your input in reviewing that text, and letting me know what I should change for your particular packages.
 
We want the text to tell the user:
 
- What to download (do they need multiple packages?)
- How to install it/where to find instructions
 
Bear in mind though, this is not intended to be the formal documentation for your package, rather it's just a quickstart guide. We want pages to remain short, and to the point to avoid boring or confusing the user.
 
Your input would be appreciated - thanks in advance!

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

[pgsql-de-allgemein] == Wöchentlicher PostgreSQL Newsletter - 22. Juni 2008 ==

Der Originalartikel befindet sich unter:
http://people.planetpostgresql.org/dfetter/index.php?/archives/178-PostgreSQL-Weekly-News-June-22-2008.html


== Wöchentlicher PostgreSQL Newsletter - 22. Juni 2008 ==

Neue Umfrage: Welches TODO würdest du am liebsten sehen?
http://www.postgresql.org/community/

== PostgreSQL Jobs im Juni ==

http://archives.postgresql.org/pgsql-jobs/2008-06/threads.php

== PostgreSQL Lokal ==

TorontoPUGs erstes Meeting wird am 23. Juni im The Rhino stattfinden.
http://pugs.postgresql.org/blog/159

OKPUG's first meeting will be June 23 at 7:00pm at Coach's in
Norman,OKPUGs erstes Meeting wird am 23. Juni um 19:00 Uhr im Coach's
in Norman, OK, stattfinden.
http://pugs.postgresql.org/node/408

PgDay.ITs Planungstreffen wird am Mittwoch, dem 25. Juni um 21:30 Uhr
CET im IRC stattfinden.
irc://irc.freenode.net/pgday-it

pgDay Portland ist am 20. Juli. genau vor der OSCON.
http://pugs.postgresql.org/node/400

PGCon Brazil 2008 wird vom 26.-27. September auf dem Unicamp in
Campinas stattfinden.
http://pgcon.postgresql.org.br/index.en.html

PGDay.IT 2008 wird am 17. und 18. Oktober in Prato stattfinden.
http://www.pgday.org/it/

== PostgreSQL in den News ==

Planet PostgreSQL: http://www.planetpostgresql.org/

General Bits, Archive und gelegentliche News Artikel:
http://www.varlena.com/GeneralBits/

Dieser wöchentliche PostgreSQL Newsletter wurde erstellt von David
Fetter und Josh Berkus.

Sende Neuigkeiten und Ankündigungen bis Sonntag, 15 Uhr Pazifischer
Zeit. Bitte sende englische Beiträge an david@fetter.org, deutsche an
pwn@pgug.de, italienische an pwn@itpug.org.

== Angewandte Patches ==

Tom Lane committed:

- Clean up a number of bogosities around pltcl's handling of the Tcl
"result": 1. Directly reading interp->result is deprecated in Tcl
8.0 and later; you're supposed to use Tcl_GetStringResult. This
code finally broke with Tcl 8.5, because Tcl_GetVar can now have
side-effects on interp->result even though it preserves the logical
state of the result. (There's arguably a Tcl issue here, because
Tcl_GetVar could invalidate the pointer result of a just-preceding
Tcl_GetStringResult, but I doubt the Tcl guys will see it as a bug.)
2. We were being sloppy about the encoding of the result: some
places would push database-encoding data into the Tcl result, which
should not happen, and we were assuming that any error result coming
back from Tcl was in the database encoding, which is not a good
assumption. 3. There were a lot of calls of Tcl_SetResult that
uselessly specified TCL_VOLATILE for constant strings. This is only
a minor performance issue, but I fixed it in passing since I had to
look at all the calls anyway. #2 is a live bug regardless of which
Tcl version you are interested in, so back-patch even to branches
that are unlikely to be used with Tcl 8.5. I went back as far as
8.0, which is as far as the patch applied easily; 7.4 was using a
different error processing scheme that has got its own problems :-(

- In pgsql/src/backend/optimizer/plan/setrefs.c, fix the code that
adds regclass constants to a plan's list of relation OIDs that it
depends on for replan-forcing purposes. We need to consider plain
OID constants too, because eval_const_expressions folds a
RelabelType atop a Const to just a Const. This change could result
in OID values that aren't really for tables getting added to the
dependency list, but the worst-case consequence would be occasional
useless replans. Per report from Gabriele Messineo.

- Clean up some problems with redundant cross-type arithmetic
operators. Add int2-and-int8 implementations of the basic
arithmetic operators +, -, *, /. This doesn't really add any new
functionality, but it avoids "operator is not unique" failures that
formerly occurred in these cases because the parser couldn't decide
whether to promote the int2 to int4 or int8. We could alternatively
have removed the existing cross-type operators, but experimentation
shows that the cost of an additional type coercion expression node
is noticeable compared to such cheap operators; so let's not give up
any performance here. On the other hand, I removed the
int2-and-int4 modulo (%) operators since they didn't seem as
important from a performance standpoint. Per a complaint last
January from ykhuang.

- In pgsql/src/backend/storage/ipc/sinvaladt.c, remove freeBackends
counter from the sinval shared memory area. We used to use it to
help enforce superuser_reserved_backends, but since 8.1 it's just
been dead weight.

- Improve error reporting for problems in text search configuration
files by installing an error context subroutine that will provide
the file name and line number for all errors detected while reading
a config file. Some of the reader routines were already doing that
in an ad-hoc way for errors detected directly in the reader, but it
didn't help for problems detected in subroutines, such as encoding
violations. Back-patch to 8.3 because 8.3 is where people will be
trying to debug configuration files.

- In pgsql/src/backend/utils/mb/mbutils.c, fix compiler warning
introduced by recent patch. Tsk tsk.

- Fix a few places that were non-multibyte-safe in tsearch
configuration file parsing. Per bug #4253 from Giorgio Valoti.

- Rewrite the sinval messaging mechanism to reduce contention and
avoid unnecessary cache resets. The major changes are: 1. When the
queue overflows, we only issue a cache reset to the specific backend
or backends that still haven't read the oldest message, rather than
resetting everyone as in the original coding. 2. When we observe
backend(s) falling well behind, we signal SIGUSR1 to only one
backend, the one that is furthest behind and doesn't already have a
signal outstanding for it. When it finishes catching up, it will in
turn signal SIGUSR1 to the next-furthest-back guy, if there is one
that is far enough behind to justify a signal. The
PMSIGNAL_WAKEN_CHILDREN mechanism is removed. 3. We don't attempt
to clean out dead messages after every message-receipt operation;
rather, we do it on the insertion side, and only when the queue
fullness passes certain thresholds. 4. Split SInvalLock into
SInvalReadLock and SInvalWriteLock so that readers don't block
writers nor vice versa (except during the infrequent queue cleanout
operations). 5. Transfer multiple sinval messages for each
acquisition of a read or write lock.

- In pgsql/src/backend/storage/ipc/sinvaladt.c, seems I was too
optimistic in supposing that sinval's maxMsgNum could be read and
written without a lock. The value itself is atomic, sure, but on
processors with weak memory ordering it's possible for a reader to
see the value change before it sees the associated message written
into the buffer array. Fix by introducing a spinlock that's used
just to read and write maxMsgNum. (We could do this with less
overhead if we recognized a concept of "memory access barrier"; is
it worth introducing such a thing? At the moment probably not --- I
can't measure any clear slowdown from adding the spinlock, so this
solution is probably fine.) Per buildfarm results.

Bruce Momjian committed:

- Move USE_WIDE_UPPER_LOWER define to c.h, and remove TS_USE_WIDE and
use USE_WIDE_UPPER_LOWER instead.

- In pgsql/src/backend/utils/mb/README, add URL for introduction to
multibyte programming in C.

- Move wchar2char() and char2wchar() from tsearch into /mb to be
easier to use for other modules; also move pnstrdup(). Clean up
code slightly.

- Add URL for TODO: "Allow pg_hba.conf to specify host names along
with IP addresses."

Neil Conway committed:

- In pgsql/doc/src/sgml/monitoring.sgml, fix a few typos in the DTrace
docs. Patch from Euler Taveira de Oliveira, along with an
additional typo I noticed along the way.

Alvaro Herrera committed:

- Improve our #include situation by moving pointer types away from the
corresponding struct definitions. This allows other headers to
avoid including certain highly-loaded headers such as rel.h and
relscan.h, instead using just relcache.h, heapam.h or genam.h, which
are more lightweight and thus cause less unnecessary dependencies.

== Abgelehnte Patches (bis jetzt) ==

No one was disappointed this week :-)

== Eingesandte Patches ==

Zoltan Boszormenyi sent in another revision of his POSIX fadvise
patch.

Simon Riggs sent in a patch to improve performance via hint bits for
write I/O.

--
Andreas 'ads' Scherbaum
Deutsche PostgreSQL User Group: http://www.pgug.de
DPWN: http://ads.wars-nicht.de/blog/categories/18-PWN


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

[pgsql-es-ayuda] RE: [pgsql-es-ayuda] Problemas con las ñ y las tildes

>Hola a todos, tengo un problema con las tildes y la ñ y es que no las
reconoce. Alguien podría decirme si existe alguna configuración especial de
>postgresql para esto.
>Gracias de antemano.

Hola Adrian. Yo tuve el mismo problema y lo solucioné creando la base de
datos con el encoding preciso.

Haz un psql -l y mira el encoding que tiene template1, por ejemplo. Pues ese
has de usar. Para castellano me he encontrado que los más habituales son
'LATIN1', 'LATIN9' y 'UTF8'. Pongamos que el tuyo (el que viste en
template1) es 'LATIN1', pues tendrás que crear la base de datos de esta
forma ...

=> create database nombrebase with encoding = 'UTF8';

.... antes de ejecutar tu script personal con el que supongo que cargas tu
estructura y datos particulares.

Espero haber ayudado, no soy ningún experto, como puedes ver.

--
TIP 4: No hagas 'kill -9' a postmaster

Re: [BUGS] BUG #4259: I don't understand this query

kannan wrote:
> The following bug has been logged online:
>
> Bug reference: 4259
> Logged by: kannan
> Email address: kannan_siva70@yahoo.com
> PostgreSQL version: 2005

There is no version 2005 of PostgreSQL. Additionally, the query syntax
you have provided below looks like it'd only be understood by Microsoft
SQL Server.

I suspect you really meant to contact Microsoft SQL Server support, not
file a bug on PostgreSQL. Microsoft people often call Microsoft SQL
Server just "SQL" but in fact SQL is the command language understood by
many different database systems, not just MS SQL Server.

> Description: I don't understand this query

That's not really a bug report. What happens when you run the query?
What did you expect to happen? If you get error messages, what is the
exact text of those error messages? What about the error messages do you
not understand?

In any case, I suspect you're better off asking this question in an MS
SQL Server forum. You might want to think about rewriting it in view of
the above questions so that when you do ask it in an appropriate place
somebody can understand it well enough to help you.

Note: I do not speak for the PostgreSQL team, I'm just a user trying to
help out.

--
Craig Ringer

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

[HACKERS] Proposal of SE-PostgreSQL patches [try#2]

Hi,

The following patch set is our second proposals of SE-PostgreSQL.

It contains many of fixes and improvements from the previous version.
Please add them a reviwing queue of the next commit fest.

Thanks,

List of Patches
===============

[1/4] Core facilities of PGACE/SE-PostgreSQL

http://sepgsql.googlecode.com/files/sepostgresql-sepgsql-8.4devel-3-r914.patch

[2/4] "--enable-selinux" option of pg_dump/pg_dumpall

http://sepgsql.googlecode.com/files/sepostgresql-pg_dump-8.4devel-3-r914.patch

[3/4] Default security policy for SE-PostgreSQL

http://sepgsql.googlecode.com/files/sepostgresql-policy-8.4devel-3-r914.patch

[4/4] Documentation updates

http://sepgsql.googlecode.com/files/sepostgresql-docs-8.4devel-3-r914.patch

We can provide a quick overview for SE-PostgreSQL at:

http://code.google.com/p/sepgsql/wiki/WhatIsSEPostgreSQL

http://sepgsql.googlecode.com/files/PGCON20080523.pdf

Compile and Installation
========================

The following items are requirements of SE-PostgreSQL.
- Fedora 8 or later system
- SELinux is enabled, and working
- kernel-2.6.23 or later
- selinux-policy and selinux-policy-devel v3.0.8 or later
- libselinux, policycoreutils, checkpolicy

The followings are step by step installation.

$ cvs -z3 -d :pserver:anoncvs@anoncvs.postgresql.org:/projects/cvsroot \
export -r HEAD -d pgsql
$ cd pgsql
$ patch -p1 < sepostgresql-sepgsql-8.4devel-3-r914.patch
$ patch -p1 < sepostgresql-pg_dump-8.4devel-3-r914.patch
$ patch -p1 < sepostgresql-policy-8.4devel-3-r914.patch
$ patch -p1 < sepostgresql-docs-8.4devel-3-r914.patch
$ ./configure --enable-selinux
$ make
$ make -C ./contrib/sepgsql_policy

$ su
# /usr/sbin/semodule -i ./contrib/sepgsql_policy/sepostgresql.pp ... [1]
# make install
# /sbin/restorecon -R /usr/local/pgsql

$ mkdir -p $PGDATA
$ chcon -t postgresql_db_t -R $PGDATA
$ initdb
$ pg_ctl start

[1] If "selinux-policy-3.4.2" or later is installed on your system,
install "sepostgresql-devel.pp" instead.
In this version, most of SE-PostgreSQL's policy are got mainlined.


Updates from the previous version
=================================

o A new type of "security_label" has gone

In the previous one, "security_context" system column is declared as
security_label type. This type had its input handler, and it translated
a given text representation into an internal Oid value with looking up
pg_security system catalog. If it's not found, the input handler inserts
a new entry automatically.

The following query can show the reason why this design is problematic.

SELECT 'system_u:object_r:sepgsql_db_t'::security_label;

This query seems to us read-only, but it has a possibility to insert
a new tuple into pg_security implicitly.

In this version, "security_context" system column is re-defined as a TEXT
type attribute, and a given text representation is translated into internal
identifier (Oid) just before insert or update a tuple. This design change
enables to make sure pg_security is not modified in read-only queries.


o Query modification has gone.

In the previous one, SE-PostgreSQL modified WHERE/JOIN ON clause to apply
tuple-level access controls, but its implementation is a bit complicated.
In addition, this design had a possibility to conflict with a new MS patent.

Now we put a hook on ExecScan to apply tuple-level access controls.
It enables to reduce code complexity and avoid patent conflicts.


o Scanning with SnapshotSelf has gone.

In the previous one, we had to scan some system catalogs with SnapshotSelf
mode at three points (pg_class, pg_largeobject and pg_security).

* When we defines a relation on heap_create_with_catalog(), a tuple of
pg_class and several tuples of pg_attribute are inserted within same
command id.
A tuple of pg_class has to be refered just before inserting tuples of
pg_attribute, because a new column inherits the security context of its
parent relation in the default. But we cannot find it because these are
inserted within same command id and SnapshotNow scanning mode ignores
these tuples. We cannot invoke CommandIdIncrement() here, because it
finally checks integrity of relation cache, but the relation is not
constructed yet.

We can apply two option here. One is preserving the security context
of parent table and applying it later without looking up pg_class.
The other is to insert a temporary entry into SysCache until it is
invalidated.
The later approach can also be applied on the next situation, so we
now put InsertSysCache() withing heap_create_with_catalog() to refer
the new tuple before next CommandIdIncrement() which is invoked just
after hecp_create_with_catalog().

* When a user gives a security context in text representation, it is
translated into an internal identifier which indicates the oid of
pg_security system catalog. If it was not found, PGACE/SE-PostgreSQL
inserts a new tuple and applies its oid as an internal identifier.
If a same new security context is given within same currentCommandId
twice or more, it tries to insert a new tuple into pg_security twice
or more. However, it violates uniqueness constraint at oid of pg_security.

Thus, we had to look up pg_security with SnapshotSelf scanning mode
as a fallback when SearchSysCache() returns invalid tuple. But we can
apply same approach here. So, InsertSysCache() is invoked to keep
a newly inserted security context until next CommandIdIncrement().

* When a user inserts or deletes a tuple within pg_largeobject directly,
it can also means create a new larageobject, or drop ones.
In SE-PostgreSQL model, it requires 'create' or 'drop' permission,
so we had to check whether the tuple is the first/last one, or not.

In this case, we assumes inserting a tuple into pg_largeobject directly
has a possibility to create new largeobject, and 'create' permission
should be always evaluated, not only 'write'.
This assumption kills to scan pg_largeobject for each insertion/deletion.

If requests come from lowrite() or lo_create(), we can distinguish its
meanings, so proper permissions are applied in the most cases.

I guess the InsertSysCache() will be an arguable interface, but it can resolve
our problem with minimum impact and utilizing existing facilities, so it is
better than any other solutuions.


o A new guc parameter to enable/disable SE-PostgreSQL

It can take four options, as follows:
sepostgresql = [ default | enforcing | permissive | disabled ]
- default: always follows kernel setting (default)
- enforcing: works in enforcing mode (MAC and audit enabled).
- permissive: works in permissive mode (audit log only).
- disabled: disables SE-PostgreSQL feature.


o PGACE hooks are inlined

The contains of src/backend/security/pgaceHooks.c are moved to
src/include/security/pgace.h and inlined.
It enables to reduce cost to invoke empty function when this
feature is disabled.


o Generic writable system column

SystemAttributeIsWritable() can abstract what system attribute is writable.
(Currently, the security system catalog is the only one writable.)
If it returns true on the target of INSERT, UPDATE or SELECT INTO, these
TargetEntries are marked as junk, and we can fetch its value on ExecutorRun()
separated from any other regular attribute.


o early security design

In the previous one, we stores a relationship between security id and
text representation on bootstraping mode, because pg_security system
catalog is not constructed yet in this time.
The current version holds them in-memory cache and writes out on the tail
of the bootstraping process.


o Documentation updates

The doc/src/sgml/security.sgml gives us a short description of SE-PostgreSQL
and PGACE security framework. In addition, we added source code comments for
most of functions, including PGACE hooks.


o Miscellaneous updates
* Two separated patches (pgace and sepgsql) are integrated into one.
* Copyrights are changed to "PostgreSQL Global Development Group".
* Several PGACE hooks are added, redefined and removed.
* Now, we can run regression test without any problem, except for two
tests which can be explained reasonably.
* SELinux state monitoring process is implemented using an existing
facilities provided by postmaster.c.
* Coding styles are fixed.
* A definition of LWlock is moved to storage/lwlock.h
* Definitions of SEvalItemXXXX are moved to nodes/nodes.h
* Compiler warnings come from SE-PostgreSQL are killed.
* Some error codes are added within 'SE' class, and elog()s which can
report user facing messages are replaced by ereport().
* Shell function is removed from genbki.sh.
* Default security context of files consider --prefix setting in
configure script.


Regression Tests
================

Now we remain two test fails, but these can be explained reasonably.

The first fail (create_function_1) means that SE-PostgreSQL detects
a client attempt to load an invalid file before core PostgreSQL doing,
and generates its error message.

The later one (sanity_check) means the regression test can detect
an increation of system catalogs correctly.

(*) Turn on "sepgsql_regression_test_mode" boolean of SELinux before
regression test. It enables you to load shared library modules
installed under user's home directory.

# /usr/sbin/setsebool sepgsql_regression_test_mode on

$ make check
:
(snip)
:
========================
2 of 115 tests failed.
========================


[kaigai@saba pgsql]$ less src/test/regress/regression.diffs
*** ./expected/create_function_1.out Fri Jun 20 14:55:12 2008
--- ./results/create_function_1.out Fri Jun 20 14:55:28 2008
***************
*** 72,78 ****
ERROR: only one AS item needed for language "sql"
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
AS 'nosuchfile';
! ERROR: could not access file "nosuchfile": No such file or directory
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
AS '/home/kaigai/tmp/e/pgsql/src/test/regress/regress.so', 'nosuchsymbol';
ERROR: could not find function "nosuchsymbol" in file "/home/kaigai/tmp/e/pgsql/src/test/regress/regress.so
"
--- 72,78 ----
ERROR: only one AS item needed for language "sql"
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
AS 'nosuchfile';
! ERROR: SELinux: could not get context of nosuchfile
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
AS '/home/kaigai/tmp/e/pgsql/src/test/regress/regress.so', 'nosuchsymbol';
ERROR: could not find function "nosuchsymbol" in file "/home/kaigai/tmp/e/pgsql/src/test/regress/regress.so
"

======================================================================

*** ./expected/sanity_check.out Sun Nov 25 12:49:12 2007
--- ./results/sanity_check.out Fri Jun 20 14:55:31 2008
***************
*** 111,116 ****
--- 111,117 ----
pg_pltemplate | t
pg_proc | t
pg_rewrite | t
+ pg_security | t
pg_shdepend | t
pg_shdescription | t
pg_statistic | t
***************
*** 149,155 ****
timetz_tbl | f
tinterval_tbl | f
varchar_tbl | f
! (138 rows)

--
-- another sanity check: every system catalog that has OIDs should have
--- 150,156 ----
timetz_tbl | f
tinterval_tbl | f
varchar_tbl | f
! (139 rows)

--
-- another sanity check: every system catalog that has OIDs should have

--
OSS Platform Development Division, NEC
KaiGai Kohei <kaigai@ak.jp.nec.com>

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

[pgadmin-hackers] SVN Commit by dpage: r7383 - trunk/pgadmin3

Author: dpage

Date: 2008-06-23 09:00:07 +0100 (Mon, 23 Jun 2008)

New Revision: 7383

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

Log:
Add todo item


Modified:
trunk/pgadmin3/TODO

--
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] Error set CLRF in SqlEditor on Windows

On Fri, Jun 20, 2008 at 12:21 PM, "Соболь А.Е." <gen_dir@infogroup.ru> wrote:
> Thanks, Dave
>
> But,
> When i work at Repository system, it doing readonly files. Many code editors
> lock input (Delphi, FoxPro, OpenOffice and other), but SqlEditor not lock.
>
> Error path
> On Step 1, i edit sql file
> On Step 2, Other user change file and put in Repository
> On Step 3, I put file also (over) and have lost lot of information.
>
> I need lock file in repository before edit. Need UnLock file before edit or
> do SaveAs.. before Edit.

Well my advice would be to use a source control system so you don't
stomp on each others work, but I realise that's not practical for
everyone. I won't object to anyone else coding up a patch for this, as
long as it's a optional feature (defaulting to off), but I don't
expect to find time to do it myself forseeable future.

I'll add it to the todo list.

--
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: [pgadmin-support] Backup/Restore problem (Windows) - newbie

On Mon, Jun 23, 2008 at 12:55 AM, rockyp <rockyp@rockyp.com> wrote:
>
> I have looked at prior messages on this topic, but haven't been able to get
> my restore to work.
>
> I am doing a backup on my client's server (I've tried, PLAIN, COMPRESSED,
> SCHEMA/DATA only).
>
> I then copy the file to my PC and want to restore here. I've tried the
> restore in PGAdmin, but the restore option is disabled. Or I try to restore
> the PLAIN versions, and again it is disabled. If I rename the .backup to
> .sql, I can load the SQL script, but it fails immediately.
>
> I guess my questions are....
>
> 1) Obviously, what are the steps to do a successful restore on a different
> PC?

Make sure the are appropriate versions of pg_dump/pg_restore can be
found. Check the path under File -> Options. That should ensure the
backup/restore options are enabled when you select an appropriate
object in the tree.

> 2) If I restore over my existing (old) DB, do I need to empty the tables, or
> delete and recreate the DB first?

I'd create a new database. In the next major release there will be a
'clean' option though so you will be able to load over an existing
database.


--
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: [pgadmin-hackers] Options request...

On Mon, Jun 23, 2008 at 12:00 AM, david <david@synergies4u.com> wrote:
> ... Per Help Doc...
>
> Maybe this is there and I just can't find it but I would like to be able
> to designate a default directory for loading and saving scripts in the
> query tool.

1.8.x should remember the last directory you used for each operation.

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

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

Re: [JDBC] JDBC and Blobs

Hi all,

Thanx for the responses. Looks like contrib/lo is the way to go !

cheers

/Dev

--- On Thu, 6/19/08, David Wall <d.wall@computer.org> wrote:
From: David Wall <d.wall@computer.org>
Subject: Re: [JDBC] JDBC and Blobs
To: dev_hyd2001@yahoo.com
Cc: pgsql-jdbc@postgresql.org
Date: Thursday, June 19, 2008, 7:33 PM


Dev wrote:
I have a field in my database table of type OID which is suppose to be used to store binary data. I plan on using the setBlob and getBlob methods for storing and retrieving entries from the table. Is that the right way to proceed? If I delete a row in that table , will it delete the binary data as well from the database server?

The JDBC driver should take care of creating and deleting the underlying LO.  However, with PG, the deleted LO isn't physically removed until you run contrib/vacuumlo.  We include vacuumlo in our daily db maintenance routines (pg_dump, vacuum, analyze, vacuumlo).

David