Re: [GENERAL] mild modification to pg_dump

2017-11-17 Thread marcelo

Again: knowing of .pgpass (thank you Scott) this is what I will do.

On 17/11/17 17:49, Ron Johnson wrote:

On 11/17/2017 02:23 PM, John R Pierce wrote:

On 11/17/2017 12:19 PM, marcelo wrote:

Sorry, I was not exact.
I don't need nor like to change pg_dump. Rather, based on pg_dump 
code, I need to develop a daemon which can receive a TCP message 
(from a privileged app) containing some elements: the database to 
dump, the user under which do that, and his password. (My apps are 
using that same data, of course, encripted to the common users).



I would just fork pg_dump to do the actual dump rather than try and 
incorporate its source code into your app.




Specifically, do you mean to write a simple daemon which forks pg_dump 
at the appropriate time?







--
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] mild modification to pg_dump

2017-11-17 Thread marcelo

Thank you, Scott.
That's happening me because incomplete docs reading.
Truly, I'm catched in a very big app, so I have no time to read all the 
docs.



On 17/11/17 18:31, Scott Mead wrote:


On Fri, Nov 17, 2017 at 4:06 PM, marcelo <marcelo.nico...@gmail.com 
<mailto:marcelo.nico...@gmail.com>> wrote:


I need to "emulate" the pg_dump code because the password prompt.
Years ago I write a program (for the QnX environment) that catched
some prompt and emulates the standard input. I don't like to do
that again.


pg_dump can use an environment variable "PGPASSWORD" upon execution 
(actually, all libpq programs can).  You could have a wrapper that 
sets the environment variable and then executes pg_dump, this would 
get you around that prompt.  Similarly, you could use the .pgpass file.


https://www.postgresql.org/docs/9.5/static/libpq-envars.html
https://www.postgresql.org/docs/9.5/static/libpq-pgpass.html

--Scott



On 17/11/17 17:23, John R Pierce wrote:

    On 11/17/2017 12:19 PM, marcelo wrote:

Sorry, I was not exact.
I don't need nor like to change pg_dump. Rather, based on
pg_dump code, I need to develop a daemon which can receive
a TCP message (from a privileged app) containing some
elements: the database to dump, the user under which do
that, and his password. (My apps are using that same data,
of course, encripted to the common users).



I would just fork pg_dump to do the actual dump rather than
try and incorporate its source code into your app.





-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org

<mailto:pgsql-general@postgresql.org>)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
<http://www.postgresql.org/mailpref/pgsql-general>




--
--
Scott Mead
Sr. Architect
/OpenSCG <http://openscg.com>/
http://openscg.com




Re: [GENERAL] mild modification to pg_dump

2017-11-17 Thread marcelo

I will give expect a try. But the source code embedded in my daemon.

On 17/11/17 17:49, Ron Johnson wrote:

On 11/17/2017 02:23 PM, John R Pierce wrote:

On 11/17/2017 12:19 PM, marcelo wrote:

Sorry, I was not exact.
I don't need nor like to change pg_dump. Rather, based on pg_dump 
code, I need to develop a daemon which can receive a TCP message 
(from a privileged app) containing some elements: the database to 
dump, the user under which do that, and his password. (My apps are 
using that same data, of course, encripted to the common users).



I would just fork pg_dump to do the actual dump rather than try and 
incorporate its source code into your app.




Specifically, do you mean to write a simple daemon which forks pg_dump 
at the appropriate time?







--
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] mild modification to pg_dump

2017-11-17 Thread marcelo
I need to "emulate" the pg_dump code because the password prompt. Years 
ago I write a program (for the QnX environment) that catched some prompt 
and emulates the standard input. I don't like to do that again.


On 17/11/17 17:23, John R Pierce wrote:

On 11/17/2017 12:19 PM, marcelo wrote:

Sorry, I was not exact.
I don't need nor like to change pg_dump. Rather, based on pg_dump 
code, I need to develop a daemon which can receive a TCP message 
(from a privileged app) containing some elements: the database to 
dump, the user under which do that, and his password. (My apps are 
using that same data, of course, encripted to the common users).



I would just fork pg_dump to do the actual dump rather than try and 
incorporate its source code into your app.







--
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] mild modification to pg_dump

2017-11-17 Thread marcelo

Sorry, I was not exact.
I don't need nor like to change pg_dump. Rather, based on pg_dump code, 
I need to develop a daemon which can receive a TCP message (from a 
privileged app) containing some elements: the database to dump, the user 
under which do that, and his password. (My apps are using that same 
data, of course, encripted to the common users).

Thank you, Scott.

On 17/11/17 10:49, Scott Mead wrote:



On Fri, Nov 17, 2017 at 7:51 AM, marcelo <marcelo.nico...@gmail.com 
<mailto:marcelo.nico...@gmail.com>> wrote:


I would need to do a mild change to pg_dump, working against a 9.4
server on linux.
Which source tree do I need? Have gcc 4.9.2 in my Lubuntu
installation.
TIA


What exactly do you need to change?  Most likely, there is a quick and 
easy fix for whatever you're doing without modifying pg_dump itself.


That being said, if you really want to modify the source, download the 
source tarball: https://www.postgresql.org/ftp/source/






-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org

<mailto:pgsql-general@postgresql.org>)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
<http://www.postgresql.org/mailpref/pgsql-general>




--
--
Scott Mead
Sr. Architect
/OpenSCG <http://openscg.com>/
http://openscg.com




[GENERAL] mild modification to pg_dump

2017-11-17 Thread marcelo
I would need to do a mild change to pg_dump, working against a 9.4 
server on linux.

Which source tree do I need? Have gcc 4.9.2 in my Lubuntu installation.
TIA



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


[GENERAL] Call a builtin function from Devart's linqConnect

2017-09-18 Thread marcelo
Sorry I'm asking this question to the list, but the Devart's 
documentation is very sparse.


I would like to call pg_try_advisory_lock( bigint ) and corresponding 
pg_advisory_unlock( bigint ) from my DAL library.


Does someone use this ORM, and call server functions using it? How is it 
done, and how to get the result?


TIA

Marcelo


--
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] Porting libpq to QNX 4.25

2017-08-25 Thread marcelo

Hi Peter

Do you believe the only path is Windows 10?
Those machines are commanding Zebra printers and collecting data in a 
very harsh environment. So, the cheaper, the better.
Why not Linux? Simply because I have Devart's Entity Developer and 
linqConnect to interface with postgres and I prefer to do all the 
development

using only one paradigm.

My best regards

Marcelo

On 25/08/17 15:26, Peter J. Holzer wrote:

On 2017-08-22 12:57:15 -0300, marcelo wrote:

We'll replace those QNX machines with WIndows XP ones

The future is already here — it's just not very evenly distributed.

 SCNR,
 hp





--
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] Porting libpq to QNX 4.25

2017-08-22 Thread marcelo

Thank you, Tom.
We'll replace those QNX machines with WIndows XP ones (via dual boot), 
so we can use our Devart's ORM the same as the most "user oriented" 
applications.



On 22/08/17 12:39, Tom Lane wrote:

marcelo <marcelo.nico...@gmail.com> writes:

Is there a libpq porting to QNX 4.25? I just tried to compile one of the
modules, but was rejected because the QNX's standard library have not an
Int64 type.

We removed QNX support in 8.2, so you could try using some pre-8.2
release.  It's possible it was broken for awhile before that, though,
since the reason for killing it was that no one had shown any interest
in testing it in a long time.

regards, tom lane





--
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] Porting libpq to QNX 4.25

2017-08-22 Thread marcelo
I'm pretty sure that Watcom 9.6 libraries lacks long long or any such 
variants.

And, of course, I don' t have another tool chain.
Thank you

On 21/08/17 22:20, George Neuner wrote:

On Mon, 21 Aug 2017 13:27:56 -0300, marcelo
<marcelo.nico...@gmail.com> wrote:


Is there a libpq porting to QNX 4.25? I just tried to compile one of the
modules, but was rejected because the QNX's standard library have not an
Int64 type.
TIA

QNX 4.25 is very old (mid 90's) - its toolchain compiler would be C90
unless you've replaced it with something newer.  I'm pretty sure
int64_t was not yet a standard type until C99.

However, many (most?) compilers already supported 64-bit ints as an
extension years before the standard emerged.

You might try "__int64", or "long long" (with or without space).  Or
search the headers for a *_MAX constant equal to 9223372036854775807.
[i.e. (2^63)-1]

George







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


[GENERAL] Porting libpq to QNX 4.25

2017-08-21 Thread marcelo
Is there a libpq porting to QNX 4.25? I just tried to compile one of the 
modules, but was rejected because the QNX's standard library have not an 
Int64 type.

TIA


--
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] Selecting some schema not suported for libpq PQconnectdbParams

2017-08-21 Thread marcelo

Thank you Jerry.
I read about "server parameters" as options, but forgotten search_path.


On 20/08/17 20:11, Jerry Sievers wrote:

marcelo <marcelo.nico...@gmail.com> writes:


The system I'm building needs to connect some QNX 4.x machines to the
Postgres' server (by the way, a Linux machine).

Of course, it will be done through a porting of the libpq library.

I was reading the possible parameters for the function mentioned in
the subject and none refers to the schema.
Also, the pg_service.conf file (to which may refer the "service"
parameter) don't add to the parameters enumerated in the section 31.1.

So... is there another way to tell the server which schema will be the
default schema for some database?

Of course, I'm asking this because the schema to use will not be the
"current user" nor "public".

.pg_service.conf...
[foo]
host=1.2.3.4
port=1234
dbname=groovydb
options=-c search_path=your_schema_of_choice,some_more_of_them_maybe

HTH


Any help will be appreciated.

TIA

Marcelo




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


[GENERAL] Selecting some schema not suported for libpq PQconnectdbParams

2017-08-20 Thread marcelo
The system I'm building needs to connect some QNX 4.x machines to the 
Postgres' server (by the way, a Linux machine).


Of course, it will be done through a porting of the libpq library.

I was reading the possible parameters for the function mentioned in the 
subject and none refers to the schema.
Also, the pg_service.conf file (to which may refer the "service" 
parameter) don't add to the parameters enumerated in the section 31.1.


So... is there another way to tell the server which schema will be the 
default schema for some database?


Of course, I'm asking this because the schema to use will not be the 
"current user" nor "public".


Any help will be appreciated.

TIA

Marcelo


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


[GENERAL] sequence used on null value or get the max value for a column whith concurrency

2017-08-10 Thread marcelo
In some table, I have a bigint column which at the app level can be 
null. Call it "DocumentNumber", and of course is not the PK.

In most cases, the applications give some value to the column.

But sometimes, the value remains null, expecting the backend or someone 
assign it a unique value.


Could I use a sequence only when the field arrives to the backend as 
null? How? Using a triger?


Alternatively:

How could I get the max value for the column and increment it by one, 
but with concurrency warranty? Something as a table lock?


TIA





--
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] ErrorCode=-2147467259 storing a .net string

2017-08-09 Thread marcelo

Solved. I recreated the database with LATIN9 encoding.


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


[GENERAL] ErrorCode=-2147467259 storing a .net string

2017-08-09 Thread marcelo
The database has UTF8 encoding. The Windows machine's locale where the 
string was created is set to es_AR.utf8.
When sending the data (thru Devart's Devart.Data.PostgreSql module) the 
server returned the error in the subject.

I don't know how exactly the offending string was encoded.
Any help will be appreciated.



--
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] Schemas and serials

2017-07-30 Thread marcelo

Addendum:

Some minutes ago, using EMS SQL Manager Lite, I tried what I was asking.
First, I created a new schema. Then, I duplicated some of the 
transactional tables from the public schema, which is acting as a 
definition repository for those tables, to the new "transactional" 
schema. After that, the serial sequence was created in the test schema.
The only caution is to inspect the sql to be executed, checking to which 
schema points every foreign key; the default, obviously, is public. That 
is OK when the FK goes to one of the reference tables; but must be 
changed when it must go to another transactional one. The example would 
be "order" and "order_detail": customer, product, etc must be referenced 
from public, but the FK from order_detail must point to season.order.


So, the question is solved, at least using some "postgresql complaint" tool.

Marcelo

On 29/07/17 17:17, Melvin Davidson wrote:


On Sat, Jul 29, 2017 at 3:38 PM, tel medola <tel.med...@gmail.com 
<mailto:tel.med...@gmail.com>> wrote:


Depends.
When you create your tables in new schema, the script was the same
from "qa"?
Sequences, tables, etc.. belong to the schema where was created.

Roberto.

Em sáb, 29 de jul de 2017 às 16:17, marcelo
<marcelo.nico...@gmail.com <mailto:marcelo.nico...@gmail.com>>
escreveu:

Some days ago I asked regarding tables located in different
schemas.
Now, my question is
Suppose I have two schemas (other than public): "qa" and
"production".
Initially I create all my tables in "qa". All of them have a
primary key
of type serial.
Later, I will copy the tables definitions to production.
It will automatically create the sequences in the new schema,
starting
at zero?
TIA
Marcelo


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


*Marcelo,
>Initially I create all my tables in "qa". All of them have a primary 
key of type serial.

>Later, I will copy the tables definitions to production.

*
*A word of caution, creating tables in a qa "schema" and then 
transferring to production is not the normal/correct (or safe) way to 
do development.

*
*The standard procedure is to create a seperate "qa" database (and/or 
server) with the exact same schema(s) as production. Then, after testing

*
*is completed, the schemas/tables are copied to production.
*

--
*Melvin Davidson*
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.




Re: [GENERAL] Schemas and serials

2017-07-30 Thread marcelo

Melvin:

My example was somewhat inexact. The full question is as follows:
I need to have two groups of tables: the "reference" ones (examples: 
city, country, customer) which will "reside" in the public schema, and 
the transaccional ones, which will reside in a schema representing one 
year/season. These table's definitions must be copied to a new schema at 
the start of new year/season.

One of these tables create script could be as follows

/CREATE TABLE dailyprogram//
//(//
//  id serial NOT NULL,//
//  date timestamp without time zone NOT NULL,//
//  packerid integer NOT NULL,//
//  CONSTRAINT "PK_dailyprogram" PRIMARY KEY (id)//
//)//
//WITH (//
//  OIDS=FALSE//
//);//
//ALTER TABLE dailyprogram//
//  OWNER TO postgres;//
/
My reworded question is: if I run this sql in the new schema, the 
implicit '/CREATE SEQUENCE dailyprogram_id_seq;/' statement will be 
executed in the new schema, so the sequence will be reset to zero?


TIA

PS: Of course, I considered the other option: to have a  table 
representing the seasons, and every main transactional table with a 
foreign key to this season table, but it add a level of indirection to a 
database which is now very convoluted.


On 29/07/17 17:17, Melvin Davidson wrote:


On Sat, Jul 29, 2017 at 3:38 PM, tel medola <tel.med...@gmail.com 
<mailto:tel.med...@gmail.com>> wrote:


Depends.
When you create your tables in new schema, the script was the same
from "qa"?
Sequences, tables, etc.. belong to the schema where was created.

    Roberto.

Em sáb, 29 de jul de 2017 às 16:17, marcelo
<marcelo.nico...@gmail.com <mailto:marcelo.nico...@gmail.com>>
escreveu:

Some days ago I asked regarding tables located in different
schemas.
Now, my question is
Suppose I have two schemas (other than public): "qa" and
"production".
Initially I create all my tables in "qa". All of them have a
primary key
of type serial.
Later, I will copy the tables definitions to production.
It will automatically create the sequences in the new schema,
starting
at zero?
TIA
Marcelo


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


*Marcelo,
>Initially I create all my tables in "qa". All of them have a primary 
key of type serial.

>Later, I will copy the tables definitions to production.

*
*A word of caution, creating tables in a qa "schema" and then 
transferring to production is not the normal/correct (or safe) way to 
do development.

*
*The standard procedure is to create a seperate "qa" database (and/or 
server) with the exact same schema(s) as production. Then, after testing

*
*is completed, the schemas/tables are copied to production.
*

--
*Melvin Davidson*
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.




[GENERAL] Schemas and serials

2017-07-29 Thread marcelo

Some days ago I asked regarding tables located in different schemas.
Now, my question is
Suppose I have two schemas (other than public): "qa" and "production".
Initially I create all my tables in "qa". All of them have a primary key 
of type serial.

Later, I will copy the tables definitions to production.
It will automatically create the sequences in the new schema, starting 
at zero?

TIA
Marcelo


--
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] Developer GUI tools for PostgreSQL

2017-07-26 Thread marcelo
You can try SQL Manager for PostgreSql. The Lite edition is enough ans 
it's free.

It's fast, secure and very friendly.

On 26/07/17 19:41, Tiffany Thang wrote:

Hi,
I'm new to PostgreSQL. I'm looking for a developer tool that works 
similarly to TOAD or SQL Developer for Oracle/MySQL which would allow 
me to view and make DDL changes to database objects and create data 
models. It would be a plus if I can use the same tool to perform some 
database administration tasks.


So far, I've found TOra and pgAdmin 4. Are there any other popular GUI 
tools?


Thanks in advance.






--
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] Schemas and foreign keys

2017-07-21 Thread marcelo

Thank you, Andreas.
Your answer closes this thread.

On 21/07/17 11:07, Andreas Kretschmer wrote:



Am 21.07.2017 um 14:58 schrieb marcelo:
Recently I asked regarding schemas, and received very useful answers. 
I conclude that I can put some tables in one schema and left others 
in the public one.
If my app selects some schema, the backend will found automatically 
the absent tables in "public".

So far, so good.
But what about foreign keys? At least, I will have foreign keys from 
the tables in the specified schema to the tables in "public", because 
I'm thinking that the tables in "public" would be references, while 
the tables residing in the specified schema will be the transactional 
ones.

TIA
Marcelo




that's no problem:

test=# create schema demo1;
CREATE SCHEMA
test=*# create schema demo2;
CREATE SCHEMA
test=*# create table master_table(id int primary key);
CREATE TABLE
test=*# create table demo1.demo_table(id int primary key, master_id 
int references public.master_table);

CREATE TABLE
test=*# create table demo2.demo_table(id int primary key, master_id 
int references public.master_table);

CREATE TABLE


Regards, Andreas





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


[GENERAL] Schemas and foreign keys

2017-07-21 Thread marcelo
Recently I asked regarding schemas, and received very useful answers. I 
conclude that I can put some tables in one schema and left others in the 
public one.
If my app selects some schema, the backend will found automatically the 
absent tables in "public".

So far, so good.
But what about foreign keys? At least, I will have foreign keys from the 
tables in the specified schema to the tables in "public", because I'm 
thinking that the tables in "public" would be references, while the 
tables residing in the specified schema will be the transactional ones.

TIA
Marcelo


--
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] What is exactly a schema?

2017-07-14 Thread marcelo
I'm sorry. dotConnect for PostgreSql is able to set the schema at 
connection time. This may be set as part of the connection string, or as 
a dbconnection class' property.


i was in doubt because the version I'm using is somewhat old, but 
decompiling it shows the property in place.


So, I will close this thread.

Thanks to all who answered. I acquired some new knowledge.

On 14/07/17 13:50, John R Pierce wrote:

On 7/14/2017 4:59 AM, marcelo wrote:

Now I have a related question.
Could I select a specific schema in the connection string? Say, by 
example database=mydb.schemanumbertwo ? 


the default search_path is $user,public

so if you connect with different SQL usernames for your different 
schemas, and have all your common tables in PUBLIC, then it will just 
fall out.   you'll need to be careful with permissions, of course.







--
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] What is exactly a schema?

2017-07-14 Thread marcelo

I'll be using Devart's dotConnect. I have two alternatives at this moment

a) To set the user name to the required schema. This has the (little) 
drawback that forces user configuration for every schema...
b) To manually do something like the JDBC driver you mention, but it 
triggers some questions
b.1) To execute the set search_path one must be connected, database name 
included. I think by that time, the default schema is determined. Or I 
am wrong, am I?
b.2) The search_path is valid for the database or restricted to the 
connection?


Thank you

On 14/07/17 09:59, Thomas Kellerer wrote:

marcelo schrieb am 14.07.2017 um 13:59:

Could I select a specific schema in the connection string? Say, by example 
database=mydb.schemanumbertwo ?

The JDBC driver does indeed support that:

jdbc:postgresql://localhost/somedatabase?currentSchema=some_schema

I think in the backround it then simply runs a

set search_path = some_schema;

after the connection has been established.








--
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] What is exactly a schema?

2017-07-14 Thread marcelo
Thank you. I know that. It would be my last resort, because aside, I 
need that every app user must login to be able to assign logical 
privileges at the app level.
Of course, I will have my own tables of users and roles, independently 
of the postgres users an roles.

I will think of it.

On 14/07/17 09:19, Bill Moran wrote:

On Fri, 14 Jul 2017 08:59:13 -0300
marcelo <marcelo.nico...@gmail.com> wrote:


Thank you.
Now I have a related question.
Could I select a specific schema in the connection string? Say, by
example database=mydb.schemanumbertwo ?

I'm asking this because I will be using Devart's dotConnect and Entity
developer to access the database. I have not full control, so I cannot
set the search path immediately after the connection.

If the first example is possible, I will replace the schema name on the
fly, before connection attempt.

I don't think you can do exactly what you're asking. However, you should
be able to achieve the same result by setting a default schema for the
user that you're connecting as. See the docs for ALTER ROLE and SET.





--
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] What is exactly a schema?

2017-07-14 Thread marcelo

Thank you.
Now I have a related question.
Could I select a specific schema in the connection string? Say, by 
example database=mydb.schemanumbertwo ?


I'm asking this because I will be using Devart's dotConnect and Entity 
developer to access the database. I have not full control, so I cannot 
set the search path immediately after the connection.


If the first example is possible, I will replace the schema name on the 
fly, before connection attempt.


TIA

On 14/07/17 07:58, Berend Tober wrote:

marcelo wrote:
The question is not trivial. Could I maintain two or three 
separate/distinct "versions" of same

database using one schema for every of them?
Could some tables (in the public schema) be shared among all the 
schemas?





Yes and yes. In the Postgresql world, the word "schema" is maybe 
unfortunately overloaded, but whenever you read it think "namespace". 
In fact, in the systems catalog there are columns named "namespace" 
that store data referring to named schemas.


-- B







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


[GENERAL] What is exactly a schema?

2017-07-14 Thread marcelo
The question is not trivial. Could I maintain two or three 
separate/distinct "versions" of same database using one schema for every 
of them?

Could some tables (in the public schema) be shared among all the schemas?


--
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] Unknown lvalue 'PIDFILE' in section 'Service'

2017-06-28 Thread marcelo



On 28/06/17 10:17, Adrian Klaver wrote:

On 06/28/2017 05:06 AM, marcelo wrote:

Hi

Today I installed postgresql 9.4 on Lubuntu 15.04 from the 
EnterpriseDB's package.


I modified pg_hba.conf to accept connections from the local network, 
and tried to start the backend. It do not; looking the log, I can see 
the message I copied to the subject. The full log entry is 
[/lib/systemd/system/postgresql-9.4.service:12] Unknown lvalue 
'PIDFILE' in section 'Service'


But the corresponding entry in 
/lib/systemd/system/postgresql-9.4.service shows 
PIDFILE=/opt/PostgreSQL/9.4/data/postmaster.pid which is perfectly 
valid, because the

data dir is Environment=PGDATA=/opt/PostgreSQL/9.4/data

What is going wrong?


I am no systemd expert by any means, but I have to believe that it 
should be:


Environment=PIDFILE=/opt/PostgreSQL/9.4/data/postmaster.pid


Hi Adrian

Thank you very much.

I tried your "recipe" and it was the solution.

But I had to change the pg_hba.conf permissions, from
-rw--- 1 root root 4318 jun 28 06:57 data/pg_hba.conf
to
-rw-r--r-- 1 root root 4318 jun 28 06:57 data/pg_hba.conf

I note this, because others may find the same issue. Now, the server is 
started!


Marcelo




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


[GENERAL] Unknown lvalue 'PIDFILE' in section 'Service'

2017-06-28 Thread marcelo

Hi

Today I installed postgresql 9.4 on Lubuntu 15.04 from the 
EnterpriseDB's package.


I modified pg_hba.conf to accept connections from the local network, and 
tried to start the backend. It do not; looking the log, I can see the 
message I copied to the subject. The full log entry is 
[/lib/systemd/system/postgresql-9.4.service:12] Unknown lvalue 'PIDFILE' 
in section 'Service'


But the corresponding entry in 
/lib/systemd/system/postgresql-9.4.service shows 
PIDFILE=/opt/PostgreSQL/9.4/data/postmaster.pid which is perfectly 
valid, because the

data dir is Environment=PGDATA=/opt/PostgreSQL/9.4/data

What is going wrong?

TIA

Marcelo




[GENERAL] Prefix LIKE search and indexes issue.

2010-07-23 Thread Marcelo de Moraes Serpa
Hello list,

So, I have a small query design issue and I'd like to borrow some of
your wisdom.

Let's say I  a users relation, and each user has a reversed_domain field.

id | name | reversed_domain
1Josh  com.app
...

I then have a firefox plugin which makes request to my application
server, sending along the current URL the user is browsing. Let's say
the URL is http://mycompany.app.com/login;. The code on the app takes
this data and:
 1) Extracts the domain out of it;
 2) Reverses the domain

We then get the following string as a result: com.app.mycompany.

I then want to find the user Josh, by reversed_domain. However, as you
can see, the strings are different, and in most cases will be. I just
want it to match the first two parts of the domain (com.app).

The following query works:

SELECT * FROM users WHERE 'com.app.mycompany' LIKE reversed_domain || %

However, it does sequential search, meaning it doesn't  use any index.

What I would like to know is, how could I make it use an index? I've
done some research and asked around #postgres but things are still not
clear to me. Some good souls hinted me at the prefix extension, but
how would I use it? Is there any other simpler / extension-free way to
solve this issue?

Thanks in advance,

Marcelo.

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


[GENERAL] PG 8.4 and pg_autovacuum functionality

2009-10-13 Thread Marcelo

Hello,

Since pg_autovacuum no longer exits on PG 8.4 and it seems that one  
now needs to provide the storage parameters during CREATE TABLE or  
later on with an ALTER TABLE.
Will that ALTER TABLE block anything going on that table until it's  
finished ? I assume not since no table data is actually being rewritten.


Thank you,
Marcelo

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


[GENERAL] Please remove me from the list!

2009-05-28 Thread Marcelo Giovane
Please, remove me from the list!

Marcelo Giovane


[GENERAL] Comando USE

2009-03-19 Thread Marcelo Giovane
É possível alterar o database corrente para criar um schema nele sem uso do \c 
do psql?

Obrigado

MarceloG


[GENERAL] pg_dump estimation

2008-06-24 Thread Marcelo Martins
is there a way to find out / calculate / estimate how big a pg_dump  
using plain text format for a DB will be ?
I have this system with a 7.4 version and a DB that is over 60GB and I  
know that the admins have never done a vacuum there.
The system only has about 20GB of free space so I don't want to take  
any chances of filling up the disk due to a pg_dump  you know.



thanks,

Marcelo
Linux/Solaris System Administrator
[EMAIL PROTECTED]
http://www.zeroaccess.org


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


[GENERAL] Can´t connect but listen address and pg_hba configured correctly

2008-04-10 Thread Marcelo de Moraes Serpa
 I can´t connect to my postgresql8.1 server running on Debian. The pgadmin
client says it can't connect. I already edited the pg_hba.conf and
postgresql.conf (listen_addresses = '*' and port) but the problem remains,
pg_admin is running on a XP machine without Firewalls enabled, Debian is
also not running any kind of firewall. I should also note the I just
upgraded to 8.1, some minutes ago I was running 7.4 and connections **were
working fine**.

pg_hba.conf:

http://www.pastebin.ca/980122

postgresql.conf (connection settings section):

http://www.pastebin.ca/980147

PostgreSQL 8.1 Debain Etch package.

Any hints greatly appreciated!

Marcelo.


Re: [GENERAL] Can´t connect but listen address and pg_hba configured correctly

2008-04-10 Thread Marcelo de Moraes Serpa
Thank you for the replies,

Actually I did not change the port number. For some bizarre reason, the
pgsql 8.1 debian package comes with port 5433 pre-configured and this was
exactly was causing the problem, of course, I wasn't noting that the port
was different, but they are so similar (that's what happens when you have a
stressful day of work..). I changed it to 5432 and everything went fine.

Do you see how little changes can make a **big** difference. I wonder what
was going through the head of the person who altered the port number for
this release...

Thanks,

Marcelo.

On Thu, Apr 10, 2008 at 5:50 PM, Kyle Wilcox [EMAIL PROTECTED] wrote:

 Did you purposely change the default port?  Are you specifying the change
 in pgadmin?  If the pg_hba.conf file is the problem, pgadmin will tell you
 with a message like:

 FATAL: no pg_hba.conf entry for host IPADDRESS, user USER, database
 DATABASE, SSL ON/OFF

 Are you getting a similar message or is the connection timing out?


 Marcelo de Moraes Serpa wrote:

   I can´t connect to my postgresql8.1 server running on Debian. The
  pgadmin
  client says it can't connect. I already edited the pg_hba.conf and
  postgresql.conf (listen_addresses = '*' and port) but the problem
  remains,
  pg_admin is running on a XP machine without Firewalls enabled, Debian is
  also not running any kind of firewall. I should also note the I just
  upgraded to 8.1, some minutes ago I was running 7.4 and connections
  **were
  working fine**.
 
  pg_hba.conf:
 
  http://www.pastebin.ca/980122
 
  postgresql.conf (connection settings section):
 
  http://www.pastebin.ca/980147
 
  PostgreSQL 8.1 Debain Etch package.
 
  Any hints greatly appreciated!
 
  Marcelo.
 
 
 --

  Kyle Wilcox
  NOAA Chesapeake Bay Office
  410 Severn Avenue
  Suite 107A
  Annapolis, MD 21403
  office: (410) 295-3151
  [EMAIL PROTECTED]

  A: It takes over twice as long to understand the conversation.
  Q: What's wrong with top-posting?
  A: Top-posting.
  Q: What's the worst thing about plain text email discussions?



Re: [GENERAL] can't create index with 'dowcast' row

2008-01-24 Thread marcelo Cortez
Louis

 what if you create one wrapper function immutable?
 some thing like this.

CREATE OR REPLACE FUNCTION myextract(timestamp )
  RETURNS date  AS
$BODY$
BEGIN
  return extract(date from $1)   ;
END;
$BODY$
  LANGUAGE 'plpgsql' IMMUTABLE

 best regards 
 mdc 

 

 
--- Louis-David Mitterrand
[EMAIL PROTECTED] escribió:

 Hi,
 
 To constraint unique'ness of my visitors to a 24h
 periode I tried 
 created a index including the 'date' part of the
 created_on timestamp:
 
   CREATE UNIQUE INDEX visit_idx ON visit_buffer USING
 btree (id_session, 
   id_story, created_on::date);
 
   psql:visit_pkey.sql:5: ERROR:  syntax error at or
 near ::
   LINE 1: ...buffer USING btree (id_session,
 id_story, created_on::date);
 
 and this:
 
   CREATE UNIQUE INDEX visit_idx ON visit_buffer USING
 btree (id_session, id_story, extract(date from
 created_on));
   psql:visit_pkey.sql:4: ERROR:  functions in index
 expression must be marked IMMUTABLE
 
 How can I achieve what I am trying?
 
 Thanks,
 
 ---(end of
 broadcast)---
 TIP 6: explain analyze is your friend
 



  Yahoo! Encuentros.

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

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [GENERAL] can't create index with 'dowcast' row

2008-01-24 Thread marcelo Cortez
Sorry forgot to mention 

later try 

CREATE UNIQUE INDEX visit_idx ON visit_buffer(
id_session, id_story ,myextract(created_on));


best regards 

 Louis
 
  what if you create one wrapper function
 immutable?
  some thing like this.
 
 CREATE OR REPLACE FUNCTION myextract(timestamp )
   RETURNS date  AS
 $BODY$
 BEGIN
   return extract(date from $1)   ;
 END;
 $BODY$
   LANGUAGE 'plpgsql' IMMUTABLE
 
  best regards 
  mdc 
 
  
 
  
 --- Louis-David Mitterrand
 [EMAIL PROTECTED] escribió:
 
  Hi,
  
  To constraint unique'ness of my visitors to a 24h
  periode I tried 
  created a index including the 'date' part of the
  created_on timestamp:
  
  CREATE UNIQUE INDEX visit_idx ON visit_buffer
 USING
  btree (id_session, 
  id_story, created_on::date);
  
  psql:visit_pkey.sql:5: ERROR:  syntax error at or
  near ::
  LINE 1: ...buffer USING btree (id_session,
  id_story, created_on::date);
  
  and this:
  
  CREATE UNIQUE INDEX visit_idx ON visit_buffer
 USING
  btree (id_session, id_story, extract(date from
  created_on));
  psql:visit_pkey.sql:4: ERROR:  functions in index
  expression must be marked IMMUTABLE
  
  How can I achieve what I am trying?
  
  Thanks,
  
  ---(end of
  broadcast)---
  TIP 6: explain analyze is your friend
  
 
 
 
   Yahoo! Encuentros.
 
 Ahora encontrar pareja es mucho más fácil, probá el
 nuevo Yahoo! Encuentros

http://yahoo.cupidovirtual.com/servlet/NewRegistration
 



  Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. 
www.tuprimeratarjeta.com.ar 

---(end of broadcast)---
TIP 6: explain analyze is your friend


[GENERAL] postgres 8.3 rc-1 ispell installation problem

2008-01-20 Thread marcelo Cortez
 hi folks

 i've tried to install ispell  for 

CREATE TEXT SEARCH DICTIONARY spanish_ispell (
TEMPLATE = ispell,
DictFile = spanish,
AffFile = spanish,
StopWords = spanish
);

sentence, but, one error ocurrs 
ERROR:  syntax error at line 432 of affix file
/usr/local/pgsql/share/tsearch_data/spanish.affix
the offending line is 

flag *J:# isimo
   E -E, 'ISIMO  #  grand'isimo  -- here  432
E-E, 'ISIMOS   # grande grand'isimos
E-E, 'ISIMA# grande grand'isima
E-E, 'ISIMAS   # grande grand'isimas
O-O, 'ISIMO# tonto tont'isimo
O-O, 'ISIMA# tonto tont'isima

i think 'I..  word is not correct for ispell, 
this should be one Í letter 
but nothing seems to work ..
I've tried  
select convert( 'ÍSIMO', 'SQL_ASCII', 'UTF8') ,
but don't work 

any clue?
best regards

sorry for my english :)



  Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. 
www.tuprimeratarjeta.com.ar 

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [GENERAL] postgres 8.3 rc-1 ispell installation problem

2008-01-20 Thread marcelo Cortez
Teodor 

i've  tried with openoffice.org but whitout success,
:)

ERROR:  invalid byte sequence for encoding UTF8:
0xe16261
HINT:  This error can also happen if the byte sequence
does not match the encoding expected by the server, 
i've  tried too with
 convmv -f iso-8859-1   --notest  -t utf-8  es_ES.dic
whitout success too.

my database encoding is LATIN1
i missing some thing ?
best regards 
mdc 

  flag *J:# isimo
 E -E, 'ISIMO  #  grand'isimo  -- here 
 432
  E-E, 'ISIMOS   # grande grand'isimos
  E-E, 'ISIMA# grande grand'isima
  E-E, 'ISIMAS   # grande grand'isimas
  O-O, 'ISIMO# tonto tont'isimo
  O-O, 'ISIMA# tonto tont'isima
  
 Current implementation doesn't accept any character
 in ending except alpha ones.
 
  i think 'I..  word is not correct for ispell, 
  this should be one Í letter 
 That's right, but you should convert dictionary and
 affix file in UTF8 encoding.
 
 
 -- 
 Teodor Sigaev  
 E-mail: [EMAIL PROTECTED]

 WWW: http://www.sigaev.ru/
 
 ---(end of
 broadcast)---
 TIP 6: explain analyze is your friend
 



  Yahoo! Encuentros.

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

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [GENERAL] postgres 8.3 rc-1 ispell installation problem

2008-01-20 Thread marcelo Cortez
Thanks Teodor 

 for quick response,and your work 

 That's right, but you should convert dictionary and
 affix file in UTF8 encoding.
how to i can do it? 
best regards
MDC 




  Yahoo! Encuentros.

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

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [GENERAL] postgres 8.3 rc-1 ispell installation problem [RESOLVED]

2008-01-20 Thread marcelo Cortez
Thanks Alvaro 

iconv -f iso-8859-1  -t utf-8  es_ES.dict  es.dict

works!! 

--- Alvaro Herrera [EMAIL PROTECTED]
escribió:

 marcelo Cortez escribió:
 
  i've  tried too with
   convmv -f iso-8859-1   --notest  -t utf-8 
 es_ES.dic
  whitout success too.
 
 convmv only recodes the name of the file -- the
 content is not affected.
 To recode the file content you need iconv.
 
 -- 
 Alvaro Herrera   
 http://www.CommandPrompt.com/
 The PostgreSQL Company - Command Prompt, Inc.
 
 ---(end of
 broadcast)---
 TIP 1: if posting/reading through Usenet, please
 send an appropriate
subscribe-nomail command to
 [EMAIL PROTECTED] so that your
message can get through to the mailing list
 cleanly
 



  Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. 
www.tuprimeratarjeta.com.ar 

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


[GENERAL] 8.3beta bug or feature?

2008-01-10 Thread marcelo Cortez
folks 

 the follow queries work in postgres 8.2 but  
 in  8.3beta don't work  


SELECT c.* FROM c WHERE  c.numero LIKE '1%';

i think automatic conversion of  numeber to text is
the problem , in 8.3beta don't work
numero field is  integer type 
any ideas?

 best regards
 mdc 

ps:PostgreSQL 8.3beta3 on i686-pc-linux-gnu, compiled
by GCC gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.0.1)


ERROR:  operator does not exist: integer ~~ unknown
LINE 2:  c.numero LIKE '1%')
  
  ^
HINT:  No operator matches the given name and argument
type(s). You might need to add explicit type casts.

** Error **

ERROR: operator does not exist: integer ~~ unknown
Estado SQL:42883
Sugerencias:No operator matches the given name and
argument type(s). You might need to add explicit type
casts.
Caracter: 141





  Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. 
www.tuprimeratarjeta.com.ar 

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org/


Re: [GENERAL] 8.3beta bug or feature?

2008-01-10 Thread marcelo Cortez
Pavel

 
--- Pavel Stehule [EMAIL PROTECTED] escribió:

 Hello,
 
 it isn't bug. You have to cast to string before.
 

http://www.postgresql.org/docs/8.3/static/release-8-3.html
 E.1.2.1. General

 Yes you are right, but my queries was generated for
one mapper ,explicit cast is not an option ( not
manual code here).
there any way simulate previous behavior? (automatic
conversion), create cast can help?
best regards.

mdc


 
 Regards
 Pavel Stehule
 
 
 On 10/01/2008, marcelo Cortez
 [EMAIL PROTECTED] wrote:
  folks
 
   the follow queries work in postgres 8.2 but
   in  8.3beta don't work
 
 
  SELECT c.* FROM c WHERE  c.numero LIKE '1%';
 
  i think automatic conversion of  numeber to text
 is
  the problem , in 8.3beta don't work
  numero field is  integer type
  any ideas?
 
   best regards
   mdc
 
  ps:PostgreSQL 8.3beta3 on i686-pc-linux-gnu,
 compiled
  by GCC gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.0.1)
 
 
  ERROR:  operator does not exist: integer ~~
 unknown
  LINE 2:  c.numero LIKE '1%')
 
^
  HINT:  No operator matches the given name and
 argument
  type(s). You might need to add explicit type
 casts.
 
  ** Error **
 
  ERROR: operator does not exist: integer ~~ unknown
  Estado SQL:42883
  Sugerencias:No operator matches the given name and
  argument type(s). You might need to add explicit
 type
  casts.
  Caracter: 141
 
 
 
 
 
Tarjeta de crédito Yahoo! de Banco
 Supervielle.
  Solicitá tu nueva Tarjeta de crédito. De tu PC
 directo a tu casa. www.tuprimeratarjeta.com.ar
 
  ---(end of
 broadcast)---
  TIP 4: Have you searched our list archives?
 
 http://archives.postgresql.org/
 
 



  Los referentes más importantes en compra/ venta de autos se juntaron:
Demotores y Yahoo!
Ahora comprar o vender tu auto es más fácil. Vistá ar.autos.yahoo.com/

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [GENERAL] 8.3beta bug or feature?

2008-01-10 Thread marcelo Cortez
Alvaro


--- Alvaro Herrera [EMAIL PROTECTED]
escribió:

 marcelo Cortez escribió:
  Pavel
  
   
  --- Pavel Stehule [EMAIL PROTECTED]
 escribió:
  
   Hello,
   
   it isn't bug. You have to cast to string before.
   
  
 

http://www.postgresql.org/docs/8.3/static/release-8-3.html
   E.1.2.1. General
  
   Yes you are right, but my queries was generated
 for
  one mapper ,explicit cast is not an option ( not
  manual code here).
  there any way simulate previous behavior?
 (automatic
  conversion), create cast can help?
 
 The cast already exist; I think you could change its
 context (from
 explicit to assignment IIRC).  This is, of
 course, not recommended.
 
 The operation you show is a pretty stupid thing for
 a mapper to do
 anyway ... I suggest you fix it.

 yeap i know , but it's third part component,fix it is
not an option this time, previous version of my
application works fine in 8.2, but i need  8.3
features like fts and others.

best regards.
mdc


 
 -- 
 Alvaro Herrera   
 http://www.CommandPrompt.com/
 PostgreSQL Replication, Consulting, Custom
 Development, 24x7 support
 
 ---(end of
 broadcast)---
 TIP 1: if posting/reading through Usenet, please
 send an appropriate
subscribe-nomail command to
 [EMAIL PROTECTED] so that your
message can get through to the mailing list
 cleanly
 



  Los referentes más importantes en compra/ venta de autos se juntaron:
Demotores y Yahoo!
Ahora comprar o vender tu auto es más fácil. Vistá ar.autos.yahoo.com/

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [GENERAL] 8.3beta bug or feature?

2008-01-10 Thread marcelo Cortez
Alvaro 

--- Alvaro Herrera [EMAIL PROTECTED]
escribió:

 marcelo Cortez escribió:
  Pavel
  
   
  --- Pavel Stehule [EMAIL PROTECTED]
 escribió:
  
   Hello,
   
   it isn't bug. You have to cast to string before.
   
  
 

http://www.postgresql.org/docs/8.3/static/release-8-3.html
   E.1.2.1. General
  
   Yes you are right, but my queries was generated
 for
  one mapper ,explicit cast is not an option ( not
  manual code here).
  there any way simulate previous behavior?
 (automatic
  conversion), create cast can help?
 
 The cast already exist; I think you could change its
 context (from
 explicit to assignment IIRC).  This is, of
 course, not recommended.


   I've created cast with  assignment from in4 to text

 but 
select 23  LIKE '2%'  fail.
ERROR:  operator does not exist: integer ~~ unknown
LINE 1: select 23  LIKE '2%' 
   ^
HINT:  No operator matches the given name and argument
type(s). You might need to add explicit type casts.

** Error **

ERROR: operator does not exist: integer ~~ unknown
Estado SQL:42883
Sugerencias:No operator matches the given name and
argument type(s). You might need to add explicit type
casts.
Caracter: 12

and i try with 

select 23 ::int4  LIKE '2%' text 

added explicit cast thinking in .. 'integer ~~
unknown'  unknow word .. confuse to me.

nothing is working 
any ideas?
is posible to locate changes  ( into sources) to
revert behavior to previous 2.8x version? 
best regards 
mdc 




 
 The operation you show is a pretty stupid thing for
 a mapper to do
 anyway ... I suggest you fix it.
 
 -- 
 Alvaro Herrera   
 http://www.CommandPrompt.com/
 PostgreSQL Replication, Consulting, Custom
 Development, 24x7 support
 
 ---(end of
 broadcast)---
 TIP 1: if posting/reading through Usenet, please
 send an appropriate
subscribe-nomail command to
 [EMAIL PROTECTED] so that your
message can get through to the mailing list
 cleanly
 



  Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. 
www.tuprimeratarjeta.com.ar 

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


[GENERAL] double free corruption?

2007-12-28 Thread marcelo Cortez
Folks

 i received the follow message from backend ,it's this
a bug?

best regards 
and happy new year 
MDC


pd: any clue are welcomed.




*** glibc detected *** postgres: postgres richelet
201.235.11.133(2504) SELECT: double free or corruption
(!prev): 0x0845d7e8 ***
=== Backtrace: =
/lib/libc.so.6[0xb7e0e930]
/lib/libc.so.6(__libc_free+0x89)[0xb7e0ff99]
postgres: postgres richelet 201.235.11.133(2504)
SELECT[0x82b1c0b]
postgres: postgres richelet 201.235.11.133(2504)
SELECT(MemoryContextDelete+0x42)[0x82b2152]
postgres: postgres richelet 201.235.11.133(2504)
SELECT(MemoryContextDeleteChildren+0x28)[0x82b2198]
postgres: postgres richelet 201.235.11.133(2504)
SELECT(MemoryContextDelete+0x12)[0x82b2122]
postgres: postgres richelet 201.235.11.133(2504)
SELECT(MemoryContextDeleteChildren+0x28)[0x82b2198]
postgres: postgres richelet 201.235.11.133(2504)
SELECT(AtAbort_Portals+0x6f)[0x82b281f]
postgres: postgres richelet 201.235.11.133(2504)
SELECT[0x80adef3]
postgres: postgres richelet 201.235.11.133(2504)
SELECT(AbortCurrentTransaction+0x25)[0x80ae115]
postgres: postgres richelet 201.235.11.133(2504)
SELECT(PostgresMain+0x25c6)[0x81f7226]
postgres: postgres richelet 201.235.11.133(2504)
SELECT[0x81ca226]
postgres: postgres richelet 201.235.11.133(2504)
SELECT(PostmasterMain+0x81d)[0x81caf0d]
postgres: postgres richelet 201.235.11.133(2504)
SELECT(main+0x1c7)[0x8182e67]
/lib/libc.so.6(__libc_start_main+0xd8)[0xb7dc0838]
postgres: postgres richelet 201.235.11.133(2504)
SELECT[0x807fa81]
=== Memory map: 
08048000-0836a000 r-xp  03:03 715320
/usr/local/pgsql/bin/postgres
0836a000-08373000 rw-p 00321000 03:03 715320
/usr/local/pgsql/bin/postgres
08373000-0846d000 rw-p 08373000 00:00 0 
[heap]
b5f0-b5f21000 rw-p b5f0 00:00 0
b5f21000-b600 ---p b5f21000 00:00 0
b60c4000-b60ce000 r-xp  03:03 744303
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1
b60ce000-b60cf000 rw-p 9000 03:03 744303
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1
b60d7000-b60d9000 r-xp  03:03 708661
/usr/lib/gconv/ISO8859-1.so
b60d9000-b60db000 rw-p 1000 03:03 708661
/usr/lib/gconv/ISO8859-1.so
b60db000-b60e3000 r-xp  03:03 527740
/usr/local/pgsql/lib/fuzzystrmatch.so
b60e3000-b60e4000 rw-p 7000 03:03 527740
/usr/local/pgsql/lib/fuzzystrmatch.so
b60e4000-b6146000 rw-p b60e4000 00:00 0
b6146000-b6154000 r-xp  03:03 709308
/lib/libresolv-2.5.so
b6154000-b6156000 rw-p d000 03:03 709308
/lib/libresolv-2.5.so
b6156000-b6158000 rw-p b6156000 00:00 0
b6158000-b615c000 r-xp  03:03 709745
/lib/libnss_dns-2.5.so
b615c000-b615e000 rw-p 3000 03:03 709745
/lib/libnss_dns-2.5.so
b615e000-b6166000 r-xp  03:03 708470
/lib/libnss_files-2.5.so
b6166000-b6168000 rw-p 7000 03:03 708470
/lib/libnss_files-2.5.so
b6169000-b617 r--s  03:03 6427  
/usr/lib/gconv/gconv-modules.cache
b617-b61a3000 r--p  03:03 8975  
/usr/lib/locale/es_AR/LC_CTYPE
b61a3000-b61a8000 r--p  03:03 16329 
/usr/lib/locale/es_AR/LC_COLLATE
b61a8000-b7daa000 rw-s  00:08 114456
/SYSV0052e2c1 (deleted)
b7daa000-b7dab000 rw-p b7daa000 00:00 0
b7dab000-b7ecd000 r-xp  03:03 709248
/lib/libc-2.5.so
b7ecd000-b7ece000 r--p 00122000 03:03 709248
/lib/libc-2.5.so
b7ece000-b7ed rw-p 00123000 03:03 709248
/lib/libc-2.5.so
b7ed-b7ed3000 rw-p b7ed 00:00 0
b7ed3000-b7ef6000 r-xp  03:03 709734
/lib/libm-2.5.so
b7ef6000-b7ef8000 rw-p 00022000 03:03 709734
/lib/libm-2.5.so
b7ef8000-b7efa000 r-xp  03:03 709751
/lib/libdl-2.5.so
b7efa000-b7efc000 rw-p 1000 03:03 709751
/lib/libdl-2.5.so
b7efc000-b7f01000 r-xp  03:03 709885
/lib/libcrypt-2.5.so
b7f01000-b7f03000 rw-p 4000 03:03 709885
/lib/libcrypt-2.5.so
b7f03000-b7f2b000 rw-p b7f03000 00:00 0
b7f2d000-b7f2e000 r-xp  03:03 715438
/usr/local/pgsql/lib/utf8_and_iso8859_1.so
b7f2e000-b7f2f000 rw-p  03:03 715438
/usr/local/pgsql/lib/utf8_and_iso8859_1.so
b7f2f000-b7f3 r--p  03:03 206641
/usr/lib/locale/es_AR/LC_TIME
b7f3-b7f31000 r--p  03:03 16760 
/usr/lib/locale/es_AR/LC_NUMERIC
b7f31000-b7f32000 r--p  03:03 206642
/usr/lib/locale/es_AR/LC_MONETARY
b7f32000-b7f33000 r--p  03:03 16336 
/usr/lib/locale/es_AR/LC_MESSAGES/SYS_LC_MESSAGES
b7f33000-b7f4d000 r-xp  03:03 709923
/lib/ld-2.5.so
b7f4d000-b7f4e000 r--p 00019000 03:03 709923
/lib/ld-2.5.so
b7f4e000-b7f4f000 rw-p 0001a000 03:03 709923
/lib/ld-2.5.so
bfdc4000-bfdda000 rw-p bfdc4000 00:00 0 
[stack]
e000-f000 r-xp  00:00 0 
[vdso]
LOG:  server process (PID 15558) was terminated by
signal 6: Aborted
LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of
another server process
DETAIL:  The postmaster has commanded 

Re: [GENERAL] double free corruption?

2007-12-28 Thread marcelo Cortez
Folks 

sorry i forgot to mention
i'm developing one c external program, may be fault is
my code , but surprise to  me the message, what bad
practice generate this behavior?
fail seems to be not to reproducible all times,

i'm using beta3 version, it's this important?

select version: 
PostgreSQL 8.3beta3 on i686-pc-linux-gnu, compiled by
GCC gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.0.1)

i'ts correct GCC version?

best regards.
MDC 

pd: gdb can help? ( for debugging my own code)
links about howto debug? 


--- Tom Lane [EMAIL PROTECTED] escribió:

 marcelo Cortez [EMAIL PROTECTED] writes:
  *** glibc detected *** postgres: postgres richelet
  201.235.11.133(2504) SELECT: double free or
 corruption
  (!prev): 0x0845d7e8 ***
 
 What PG version is this?  Can you provide a
 reproducible test case?
 
   regards, tom lane
 
 ---(end of
 broadcast)---
 TIP 5: don't forget to increase your free space map
 settings
 



  Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. 
www.tuprimeratarjeta.com.ar 

---(end of broadcast)---
TIP 6: explain analyze is your friend


[GENERAL] postgres8.3beta encodding problem?

2007-12-17 Thread marcelo Cortez

Folks


select chr(165);
ERROR:  requested character too large for encoding:
165
 it's one old scrip if not remember wrong works
postgres in 8.2.4
any clue?
best regars 
mdc 

info:
select version().
PostgreSQL 8.3beta3 on i686-pc-linux-gnu, compiled by
GCC gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.0.1)

show all 

add_missing_from;off
allow_system_table_mods;off
archive_command;(disabled)
archive_mode;off
archive_timeout;0
array_nulls;on
authentication_timeout;1min
autovacuum;on
autovacuum_analyze_scale_factor;0.1
autovacuum_analyze_threshold;50
autovacuum_freeze_max_age;2
autovacuum_max_workers;3
autovacuum_naptime;1min
autovacuum_vacuum_cost_delay;20ms
autovacuum_vacuum_cost_limit;-1
autovacuum_vacuum_scale_factor;0.2
autovacuum_vacuum_threshold;50
backslash_quote;safe_encoding
bgwriter_delay;200ms
bgwriter_lru_maxpages;100
bgwriter_lru_multiplier;2
block_size;8192
bonjour_name;
check_function_bodies;on
checkpoint_completion_target;0.5
checkpoint_segments;3
checkpoint_timeout;5min
checkpoint_warning;30s
client_encoding;latin1
client_min_messages;notice
commit_delay;0
commit_siblings;5
config_file;/usr/local/pgsql/data/postgresql.conf
constraint_exclusion;off
cpu_index_tuple_cost;0.005
cpu_operator_cost;0.0025
cpu_tuple_cost;0.01
custom_variable_classes;
data_directory;/usr/local/pgsql/data
DateStyle;ISO, DMY
db_user_namespace;off
deadlock_timeout;1s
debug_assertions;off
debug_pretty_print;off
debug_print_parse;off
debug_print_plan;off
debug_print_rewritten;off
default_statistics_target;10
default_tablespace;
default_text_search_config;pg_catalog.spanish
default_transaction_isolation;read committed
default_transaction_read_only;off
default_with_oids;off
dynamic_library_path;$libdir
effective_cache_size;128MB
enable_bitmapscan;on
enable_hashagg;on
enable_hashjoin;on
enable_indexscan;on
enable_mergejoin;on
enable_nestloop;on
enable_seqscan;on
enable_sort;on
enable_tidscan;on
escape_string_warning;on
explain_pretty_print;on
external_pid_file;
extra_float_digits;0
from_collapse_limit;8
fsync;on
full_page_writes;on
geqo;on
geqo_effort;5
geqo_generations;0
geqo_pool_size;0
geqo_selection_bias;2
geqo_threshold;12
gin_fuzzy_search_limit;0
hba_file;/usr/local/pgsql/data/pg_hba.conf
ident_file;/usr/local/pgsql/data/pg_ident.conf
ignore_system_indexes;off
integer_datetimes;off
join_collapse_limit;8
krb_caseins_users;off
krb_realm;
krb_server_hostname;
krb_server_keyfile;
krb_srvname;postgres
lc_collate;es_AR
lc_ctype;es_AR
lc_messages;es_AR
lc_monetary;es_AR
lc_numeric;es_AR
lc_time;es_AR
listen_addresses;*
local_preload_libraries;
log_autovacuum_min_duration;-1
log_checkpoints;off
log_connections;off
log_destination;stderr
log_directory;pg_log
log_disconnections;off
log_duration;off
log_error_verbosity;default
log_executor_stats;off
log_filename;postgresql-%Y-%m-%d_%H%M%S.log
log_hostname;off
log_line_prefix;
log_lock_waits;off
log_min_duration_statement;-1
log_min_error_statement;error
log_min_messages;notice
log_parser_stats;off
log_planner_stats;off
log_rotation_age;1d
log_rotation_size;10MB
log_statement;all
log_statement_stats;off
log_temp_files;-1
log_timezone;America/Buenos_Aires
log_truncate_on_rotation;off
logging_collector;off
maintenance_work_mem;16MB
max_connections;100
max_files_per_process;1000
max_fsm_pages;153600
max_fsm_relations;1000
max_function_args;100
max_identifier_length;63
max_index_keys;32
max_locks_per_transaction;64
max_prepared_transactions;5
max_stack_depth;2MB
password_encryption;on
port;5432
post_auth_delay;0
pre_auth_delay;0
random_page_cost;4
regex_flavor;advanced
search_path;$user,public
seq_page_cost;1
server_encoding;LATIN1
server_version;8.3beta3
server_version_num;80300
session_replication_role;origin
shared_buffers;24MB
shared_preload_libraries;
silent_mode;off
sql_inheritance;on
ssl;off
standard_conforming_strings;off
statement_timeout;0
superuser_reserved_connections;3
synchronous_commit;on
syslog_facility;LOCAL0
syslog_ident;postgres
tcp_keepalives_count;9
tcp_keepalives_idle;7200
tcp_keepalives_interval;75
temp_buffers;1024
temp_tablespaces;
TimeZone;America/Buenos_Aires
timezone_abbreviations;Default
trace_notify;off
trace_sort;off
track_activities;on
track_counts;on
transaction_isolation;read committed
transaction_read_only;off
transform_null_equals;off
unix_socket_directory;
unix_socket_group;
unix_socket_permissions;511
update_process_title;on
vacuum_cost_delay;0
vacuum_cost_limit;200
vacuum_cost_page_dirty;20
vacuum_cost_page_hit;1
vacuum_cost_page_miss;10
vacuum_freeze_min_age;1
wal_buffers;64kB
wal_sync_method;fdatasync
wal_writer_delay;200ms
work_mem;1MB
xmlbinary;base64
xmloption;content
zero_damaged_pages;off




  Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. 
www.tuprimeratarjeta.com.ar 

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[GENERAL] 8.3 beta FATAL: invalid value for parameter timezone_abbreviations: Default

2007-12-05 Thread marcelo Cortez
folks


 i've installed 8.3beta but at start up receive

FATAL:  invalid value for parameter
timezone_abbreviations: Default


any clue?
best regards.
MDC


 info:

Linux richelet-internet 2.6.21.6 #9 SMP Sun Dec 2
17:52:20 ART 2007 i686 Pentium III (Coppermine)
GenuineIntel GNU/Linux

gp_config

BINDIR = /usr/bin
DOCDIR = /usr/doc
INCLUDEDIR = /usr/include
PKGINCLUDEDIR = /usr/include
INCLUDEDIR-SERVER = /usr/include/server
LIBDIR = /usr/lib
PKGLIBDIR = /usr/lib
LOCALEDIR =
MANDIR = /usr/man
SHAREDIR = /usr/share
SYSCONFDIR = /usr/etc
PGXS = /usr/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE =
CC = gcc
CPPFLAGS = -D_GNU_SOURCE
CFLAGS = -O2 -Wall -Wmissing-prototypes
-Wpointer-arith -Winline -Wdeclaration-after-statement
-Wendif-labels -fno-strict-aliasing
CFLAGS_SL = -fpic
LDFLAGS = -Wl,-rpath,'/usr/local/pgsql/lib'
LDFLAGS_SL =
LIBS = -lpgport -lz -lreadline -lcrypt -ldl -lm
VERSION = PostgreSQL 8.3beta3


postgresql.conf
# -
# PostgreSQL configuration file
# -
#
# This file consists of lines of the form:
#
#   name = value
#
# (The '=' is optional.)  White space may be used. 
Comments are introduced
# with '#' anywhere on a line.  The complete list of
option names and
# allowed values can be found in the PostgreSQL
documentation.  The
# commented-out settings shown in this file represent
the default values.
#
# Please note that re-commenting a setting is NOT
sufficient to revert it
# to the default value, unless you restart the server.
#
# Any option can also be given as a command line
switch to the server,
# e.g., 'postgres -c log_connections=on'.  Some
options can be changed at
# run-time with the 'SET' SQL command.
#
# This file is read on server startup and when the
server receives a
# SIGHUP.  If you edit the file on a running system,
you have to SIGHUP the
# server for the changes to take effect, or use
pg_ctl reload. Some
# settings, which are marked below, require a server
shutdown and restart
# to take effect.
#
# Memory units:  kB = kilobytes MB = megabytes GB =
gigabytes
# Time units:ms = milliseconds s = seconds min =
minutes h = hours d = days


#---
# FILE LOCATIONS
#---

# The default values of these variables are driven
from the -D command line
# switch or PGDATA environment variable, represented
here as ConfigDir.

#data_directory = 'ConfigDir'   # use data in another
directory
# (change requires restart)
#hba_file = 'ConfigDir/pg_hba.conf' # host-based
authentication file
# (change requires restart)
#ident_file = 'ConfigDir/pg_ident.conf' # ident
configuration file
# (change requires restart)

# If external_pid_file is not explicitly set, no extra
PID file is written.
#external_pid_file = '(none)'   # write an extra PID
file
# (change requires restart)


#---
# CONNECTIONS AND AUTHENTICATION
#---

# - Connection Settings -

listen_addresses = '*'  # what IP address(es) to
listen on; 
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
# (change requires restart)
#port = 5432# (change requires restart)
max_connections = 100   # (change requires restart)
# Note: increasing max_connections costs ~400 bytes of
shared memory per 
# connection slot, plus lock space (see
max_locks_per_transaction).  You
# might also need to raise shared_buffers to support
more connections.
#superuser_reserved_connections = 3 # (change requires
restart)
#unix_socket_directory = '' # (change requires
restart)
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = 0777 # octal
# (change requires restart)
#bonjour_name = ''  # defaults to the computer name
# (change requires restart)

# - Security  Authentication -

#authentication_timeout = 1min  # 1s-600s
#ssl = off  # (change requires restart)
#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH'  #
Allowed SSL ciphers
# (change requires restart)
#password_encryption = on
#db_user_namespace = off

# Kerberos and GSSAPI
#krb_server_keyfile = ''# (change requires restart)
#krb_srvname = 'postgres'   # (change requires restart,
kerberos only)
#krb_server_hostname = ''   # empty 

Re: [GENERAL] 8.3 beta FATAL: invalid value for parameter timezone_abbreviations: Default

2007-12-05 Thread marcelo Cortez
Alvaro ,folks


--- Alvaro Herrera [EMAIL PROTECTED] escribió:

 marcelo Cortez escribió:
  folks
  
  
   i've installed 8.3beta but at start up receive
  
  FATAL:  invalid value for parameter
  timezone_abbreviations: Default
 
 Do you have a file named Default on the
 share/timezonesets dir?

 Yes i do.

 
 I'm wondering if your installation is being
 mistakenly trying to use a
 different sharedir than it should be.  What does
 pg_config --sharedir

your are right .
pg_config --sharedir 
response -- /usr/share
i try link file- :)

 say; is it what you expect? (i.e. wherever you
 installed the beta)
 
 -- 
 Alvaro Herrera
 http://www.flickr.com/photos/alvherre/
 Este mail se entrega garantizadamente 100% libre de
 sarcasmo.
 



  Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. 
www.tuprimeratarjeta.com.ar 

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [GENERAL] Tsearch2 - spanish

2007-09-20 Thread marcelo Cortez
Felipe 

--- Felipe de Jesús Molina Bravo
[EMAIL PROTECTED] escribió:

 Hi
 
 You are rigth, the output of show lc_ctype; is C.
 
 Then I did is:
 
 prueba1=# show lc_ctype;
 lc_ctype 
 -
  es_MX.ISO8859-1
 (1 row)
 
 and do it
 
  % initdb -D /YOUR/PATH -E LATIN1 --locale
 es_ES.ISO8859-1
 
 (how you do say)
 
 and createdb -E iso8859-1 prueba1 and finally
 tsearch2
 
 the original problem is resolved
 
 prueba1=# select to_tsvector('espanol','melón');
  to_tsvector 
 -
  'melón':1
 (1 row)
 
 
 but if I change the sentece for it:
 
 prueba1=# select to_tsvector('espanol','melón  perro
 mordelón');
 server closed the connection unexpectedly
 This probably means the server terminated
 abnormally
 before or while processing the request.
 The connection to the server was lost. Attempting
 reset: Failed.
 ! 

 The same thing he same thing happened my to me at 
first time with 
 Tsearch2 - spanish , i think you need 
 patch snowball with tsearch_snowball_82 file ,
googling
 you find instructions how doit .
 best regards 
 mdc 
 
 
 ??? lost the connection ... the server is up 
 any idea?
 
 The synonym is intentional
 
 
 thanks in advanced
 
 
 El mar, 18-09-2007 a las 21:40 +0400, Teodor Sigaev
 escribió:
   LC_CTYPE=POSIX
  
  
  pls, output of show lc_ctype; command. If it's C
 locale then I can identify 
  problem - characters diacritical mark (as ó) is
 not an alpha character, and 
  ispell dictionary will fail. To fix that you
 should run initdb with options:
  % initdb -D /YOUR/PATH -E LATIN1 --locale
 es_ES.ISO8859-1
  or
  % initdb -D /YOUR/PATH -E UTF8 --locale es_ES.UTF8
  
  In last case you should also recode all
 dictionary's datafile in utf8 encoding.
  
   prueba=# select
 to_tsvector('espanol','melón');
   ERROR:  Affix parse error at 506 line
   and
   prueba=# select lexize('sp','melón');
lexize  
   -
{melon}
   (1 row)
  sp is a Snowball stemmer, it doesn't require affix
 file, so it works.
  
  By the way, why is synonym dictionary paced after
 ispell? is it intentional?
  Usually, synonym dictionary goes first, then
 ispell and after all of them snowball.
  
 
 ---(end of
 broadcast)---
 TIP 1: if posting/reading through Usenet, please
 send an appropriate
subscribe-nomail command to
 [EMAIL PROTECTED] so that your
message can get through to the mailing list
 cleanly
 



  Seguí de cerca a la Selección Argentina de Rugby en el Mundial de Francia 
2007.
http://ar.sports.yahoo.com/mundialderugby

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[GENERAL] difference between function and stored procedure

2007-08-28 Thread Marcelo de Moraes Serpa
Hello list,

Is there any difference between a PGSQL Function and Stored Procedure in
PostgreSQL (8.2) ?

If so, what difference? Is the SQL used to create a SP different from the
SQL used to create a function ?

Thanks in advance,

Marcelo.


[GENERAL] create or replace for tables and schemas

2007-08-27 Thread Marcelo de Moraes Serpa
For some weid reason, I can't use a stored function nor return data from
sql, just send sql to the database, that's my constraint for now and I have
to deal with it.

I have to create a schema and just after a table in this schema. I can't
check for the existence of the table nor the schema. If the sql code to
create the table and the schema is ran when the schema and or the table
exist, a sql excepetion is thrown and my application halts.

With this in mind, I'd like to know if there is something like CREATE OR
REPLACE for tables and schemas so that if the object already exists, it will
just replace it.

For those curious, my company uses an application generator called GeneXus,
it has a sql command which allows you to send direct sql sentences to
the database **as long as** they don't return anything. Oh life.

Anyway, thanks in advance,

Marcelo.


Re: [GENERAL] create or replace for tables and schemas

2007-08-27 Thread Marcelo de Moraes Serpa
Thanks Martijn

On 8/27/07, Martijn van Oosterhout [EMAIL PROTECTED] wrote:

 On Mon, Aug 27, 2007 at 08:24:51AM -0300, Marcelo de Moraes Serpa wrote:
  With this in mind, I'd like to know if there is something like CREATE OR
  REPLACE for tables and schemas so that if the object already exists, it
 will
  just replace it.

 Looks lke DROP IF EXISTS was made for you.

 Have a nice day,
 --
 Martijn van Oosterhout   [EMAIL PROTECTED]   http://svana.org/kleptog/
  From each according to his ability. To each according to his ability to
 litigate.

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.1 (GNU/Linux)

 iD8DBQFG0rflIB7bNG8LQkwRAsOZAJ0QyEMaNtMR0Sa1xmuzPDT58So35wCgg8qw
 5r27tWKhBnYAkspu34z91Og=
 =KhPb
 -END PGP SIGNATURE-




[GENERAL] [ERROR] syntax error at end of input

2007-08-27 Thread Marcelo de Moraes Serpa
Hello list,

I'm trying to execute the following sentences in a pl/pgsql function.
aNomeProcAudita and pTabAudit are both variables.

   DROP FUNCTION IF EXISTS aNomeProcAudita;
   DROP TRIGGER IF EXISTS 'Audita_' || pTabAudit || '_trigger';


When I try to create this function without these two sentences, everything
goes ok, however, when I've got these two sql senteces, I get the following
error:

ERROR: syntax error at end of input

Is there anything wrong with the code?

Thanks in advance,

Marcelo.


Re: [GENERAL] Audit-trail engine inner-workings

2007-08-22 Thread Marcelo de Moraes Serpa
Hey Ted, thanks for the reply,

In respect of web application architecture, I'm fully aware of session
persistence mechanisms (I work as a developer of web apps after all).

What I really would like to know is the inner-workings of the set_session_id
and current_session_id as well as reset_session_id C functions.

Our company uses a generator called GeneXus which is high level modeling
enviroment that deployes to a variety of languages Java being one of them.
Being a generator, we don't have much information about the way it generates
the code becouse 1) it is a proprietary generator, 2) the code generated is
propositally cryptic (don't make any sense at all, with weird var and method
names and so on).

However, I was given the mission to implement an audit-trail engine to this
application. The discussion I sent in the first message of this thread was
really helpful, the C functions sent by Manual were crucial. They work fine,
**but** I don't have much knowledge in C nor PostgreSQL internal
architecture **and** we need to know certain inner details on how this
mechanism works in order to take some important decisions.

I know that this PostgreSQL C module has a static var that in turn keeps the
integer set by the function set_session_id - but is this var global to the
server's service ? Does PostgreSQL mantain one instance of this var per
requested connection ? I would like to know how this works.

Take the following scenario:
 - user enters the web app;
 - web app takes a reference to a connection from the db connection pool;
 - web app does some db operation

When the app takes a reference to a connection and does the operation, just
after that, in the application, I set the session id. Then the db operation
is performed and the audit stored procedure is ran. The audit-trail engine
performs its work and logs the operation and modifications the user did as
well as **which application user did it** (which is the purpose of the
set_session_id technique - being able to pass the application user who did
the operation to the server so that that the audit-trail can log it
altogether).

Once the operation is done and the connection is back to the pool, does
PostgreSQL discart the associated var ? Does it mantain one instance per
request made ? That's what I would like to know.

Thanks,

On 8/21/07, Ted Byers [EMAIL PROTECTED] wrote:


 --- Marcelo de Moraes Serpa [EMAIL PROTECTED]
 wrote:

  Hello list,
  [snip]
 
  * Each http request gets an instance of a session_id
  ? Or is it
  per-connection ?

 It depends.  There is no necessary correlation between
 a session as defined within a web application and a
 session as defined in the RDBMS.  I routinely set up
 web applications that may have multiple sessions as
 seen by the RDBMS.  Consider the idiom of doing
 operations with the least priviledge required to get
 the job done.  The application might log into the
 database as one databse user with very limited rights,
 to authenticate the user and pass data to the web
 application regarding what the user is permitted to do
 (all server side, on the application server).  Then,
 the application may log in as a very different user
 with limited rights to perform some operation the user
 has initiated.  So far, we have two sessions as far as
 the database is concerned and only one as far as the
 web application is concerned.

 If you're working with web applications, you must know
 that multiple http requests can share a web
 application session, as can multiple web applications
 (if written to do so using the single sign-on idiom),
 assuming you use technologies such as cookies or URL
 rewriting or hidden form fields, or the magic of
 ASP.NET, to set up and maintain sessions, and that the
 session is restricted to a single http request if you
 don't (plain old http/html is stateless, so there is
 no useful concept of session without help from other
 technologies).

 HTH

 Ted




[GENERAL] Audit-trail engine inner-workings

2007-08-21 Thread Marcelo de Moraes Serpa
Hello list,

Taking this discussion as a base:

http://archives.postgresql.org/pgsql-general/2007-04/msg01034.php

Manuel helped me to develop an audit-trail engine, and even though it works
ok, I need to know better its inner workings:

From what I understand, the flow is something like this:
   * User sends http request to server to update some record (for example);
   * The application server (tomcat) runs the servlet and the servlet gets a
connection from the pool
   * The servlet runs the set_session_id(integer) to set a session for
this request and saves the current application user in the lookup table
(session_id,user_id)
   * The db operation is done (db saved) - the user name is retrieved
through a lookup into the table mentioned above by getting this request's
session_id by running the current_session_id SP

* Each http request gets an instance of a session_id ? Or is it
per-connection ?
* Do I really need to call reset_session_id ? Isn't this connection
destroyed after it has been used by the application?
* Would it work with an application which does not use a connection pool but
a permanent connection (such as desktop apps)?

Thanks in advance!

Marcelo.


[GENERAL] Performance question

2007-08-16 Thread Marcelo de Moraes Serpa
Hello list,

If I've got a trigger that calls a function each time there is a DELETE or
UPDATE opration on a table in my system, and in this function I retrieve
some boolean information from another table and based on this information,
additional code will be ran or not in this function. Could the solely fact
of calling the function and selecting the data on another table (and the
trigger on each update and delete on any table) affect the overall db
performance in a noticiable manner ?


[GENERAL] help with tsearch2 stem compile

2007-07-21 Thread marcelo Cortez
hi all

 i'm using postgresql 8.2.4 and install tsearch2 , but
i need spanish idiom.
following
http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/docs/README.gendict
and downloading 
http://snowball.tartarus.org/algorithms/spanish/stemmer.html
stem.c and stem.h

 ./config.sh -n pt -s -p spanish_ISO_8859_1   -v
-C'Snowball stemmer for spanish'
Dictname: 'pt'
Snowball stemmer: yes
Has init method: yes
Function prefix: spanish_ISO_8859_1
Source files: stem.c
Header files: stem.h
Object files: stem.o dict_snowball.o
Comment: 'Snowball stemmer for spanish'
Directory: ../../dict_pt
Build directory...  ok
Build Makefile...  ok
Build dict_pt.sql.in...  ok
Copy source and header files...  ok
Build sub-include header...  ok
Build Snowball stemmer...  ok
Build README.pt...  ok
All is done

and 

 cd ../../dict_pt/
make 
.
.
.
.
 stem.c: In function 'spanish_ISO_8859_1_close_env':
stem.c:1092: error: too many arguments to function
'SN_close_env'
make: *** [stem.o] Error 1

any clue?
best regards

 mdc






__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org/


[GENERAL] tsearch2 on postgres8.2.4

2007-07-18 Thread marcelo Cortez
Hi all

 has anybody created using  Gendict generate
dictionary  in spanish successful ?.
 



  __ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [GENERAL] troubble with contrib compile

2007-07-12 Thread marcelo Cortez
Tom 

 Thanks works fine!
 best regards
 mdc
--- Tom Lane [EMAIL PROTECTED] escribió:

 marcelo Cortez [EMAIL PROTECTED] writes:
   i downloaded  postgres8.2.4 sources , expand and
  ./configure and install with success.
  Now i need one module from contrib directory , 
  fuzzystrmatch
   cd /postgres/contrib/fuzzymatchstr [ ok ]
   make 
   throws
 
   make
  Makefile:15: ../../src/Makefile.global: No such
 file
  or directory
 
 You seem to have removed the results of configure. 
 As a general rule
 it's best to build the contrib modules in the same
 tree where you just
 built the Postgres core --- they definitely need
 configure's outputs
 and I think some of them require other files that
 get built along the
 way.
 
 If you are trying to match a previously built core
 system, be sure to
 re-configure with the exact same configure options,
 else the contrib
 modules may not work.  pg_config --configure will
 help refresh your
 memory if you forgot what you used ...
 
   regards, tom lane
 
 ---(end of
 broadcast)---
 TIP 6: explain analyze is your friend
 







__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org/


[GENERAL] troubble with contrib compile

2007-07-11 Thread marcelo Cortez

 hi all 


 i downloaded  postgres8.2.4 sources , expand and
./configure and install with success.
Now i need one module from contrib directory , 
fuzzystrmatch

 cd /postgres/contrib/fuzzymatchstr [ ok ]
 make 

 throws

 make
Makefile:15: ../../src/Makefile.global: No such file
or directory
Makefile:16: /contrib/contrib-global.mk: No such file
or directory
make: *** No rule to make target
`/contrib/contrib-global.mk'.  Stop.

i'm wrong?
any clue?

best regards
 mdc

more data : ( from select version() ).

PostgreSQL 8.2.4 on i686-pc-linux-gnu, compiled by
GCC gcc (GCC) 4.1.1 (Gentoo 4.1.1-r3)








__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [GENERAL] PostgreSQL Installer for Windows x64

2007-06-20 Thread marcelo Cortez
Magnus , folks

 The only caveat i found in winxp64 is with psqlODBC 
 my application dont work very well on it into xp64
platform, the work around was change odbc profile in
favor of  dns file , with dns file my application
return  to work, ok.
 BTW i using linux server without problems, but my 
client aplication layer was the problem :(.

best regards
 
  MDC

--- Magnus Hagander [EMAIL PROTECTED] escribió:

 On Wed, Jun 20, 2007 at 10:17:10AM +0900, EBIHARA,
 Yuichiro wrote:
  Hi,
  
  Can I get a PostgreSQL Installer for Windows
 x64(EM64T)?
  That for 32bit Windows is available at
 http://www.postgresql.org/ftp/win32/ but I need x64
 native
  version.
 
 There is no such thing. PostgreSQL 64-bit is
 currently only supported on
 Unix based platforms.
 
 The 32-bit version for Windows works just fine on
 64-bit windows, though.
 
 //Magnus
 
 ---(end of
 broadcast)---
 TIP 4: Have you searched our list archives?
 
http://archives.postgresql.org/
 







__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[GENERAL] help with libpq program

2007-06-18 Thread marcelo Cortez

folks 

 i need help with libpq program ,i made on C program
for
wrapper libpq.dll program , the routine failing is 
copy from stdin interface.

PQputCopyData return 1 (AKA ok)
PQputCopyEnd  return 1 (AKA ok)
but nothing is append to database.
tailing log file 

 invalid input syntax for integer: 3hello world  
  4.5

CONTEXT:  COPY foo, line 1, column a: 3hello
world 4.5

STATEMENT:  copy foo from stdin

data seems to be correct 
3\ hello world \   4.5\n
\\.\n

database ( is for one example found at google)
create table foo (a int4, b char(16), d float8);
copy foo from stdin;

3\ hello world \   4.5\n
\\.\n

I'm wrong?

what is way to diagnose?
any sugestion are welcomed 
best regards 

  MDC

PD: any example are welcomed too.







__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [GENERAL] help with libpq program

2007-06-18 Thread marcelo Cortez
DAnn


 My c code is one layer for wrap libpq.dll functions
 i'm using function like 

start with

PGresult *PQexec(PGconn *conn, const char *command);

 command like  'copy foo  from stdin ';

int PQputCopyData(PGconn *conn,
  const char *buffer,
  int nbytes);

(many times)
int PQputCopyEnd(PGconn *conn,
 const char *errormsg);

 I was sucessfull with append CSV

 delimiter if not specified is tab character (from
documentation)

The problem was numeric formats, i can't find 
solution for this but with CSV append was succesfull.
Thank for responses

 Best regards
 MDC


--- Dann Corbit [EMAIL PROTECTED] escribió:

 Where is your actual copy statement?
 What is your field delimiter?
 
 Why not post the actual C code for your program, if
 it is not too long?
 
 I guess from what you have posted that the delimiter
 you supplied does not match the delimiter from your
 copy statement.
 
  -Original Message-
  From: [EMAIL PROTECTED]
 [mailto:pgsql-general-
  [EMAIL PROTECTED] On Behalf Of marcelo Cortez
  Sent: Saturday, June 16, 2007 9:04 PM
  To: pgsql-general@postgresql.org
  Subject: [GENERAL] help with libpq program
  
  
  folks
  
   i need help with libpq program ,i made on C
 program
  for
  wrapper libpq.dll program , the routine failing is
  copy from stdin interface.
  
  PQputCopyData return 1 (AKA ok)
  PQputCopyEnd  return 1 (AKA ok)
  but nothing is append to database.
  tailing log file
  
   invalid input syntax for integer: 3hello
 world
4.5
  
  CONTEXT:  COPY foo, line 1, column a: 3   
 hello
  world 4.5
  
  STATEMENT:  copy foo from stdin
  
  data seems to be correct
  3\ hello world \   4.5\n
  \\.\n
  
  database ( is for one example found at google)
  create table foo (a int4, b char(16), d float8);
  copy foo from stdin;
  
  3\ hello world \   4.5\n
  \\.\n
  
  I'm wrong?
  
  what is way to diagnose?
  any sugestion are welcomed
  best regards
  
MDC
  
  PD: any example are welcomed too.
  
  
  
  
  
  
  
  __
  Preguntá. Respondé. Descubrí.
  Todo lo que querías saber, y lo que ni imaginabas,
  está en Yahoo! Respuestas (Beta).
  ¡Probalo ya!
  http://www.yahoo.com.ar/respuestas
  
  
  ---(end of
 broadcast)---
  TIP 6: explain analyze is your friend
 
 ---(end of
 broadcast)---
 TIP 1: if posting/reading through Usenet, please
 send an appropriate
subscribe-nomail command to
 [EMAIL PROTECTED] so that your
message can get through to the mailing list
 cleanly
 







__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org/


Re: [GENERAL] initdb

2007-06-17 Thread marcelo Cortez
Hi Jhon


 Diferent distros put file in diferent path
 try
 /usr/local/pgsql/initdb bla bla bla
or

 /var/lib/postgres/bin/initdb bla bla bla 
 
 or 
 locate initdb 
for locate that file 
best regards

 mdc
--- John K Masters [EMAIL PROTECTED]
escribió:

 I feel somewhat embarrassed to post this but I can't
 get past the first
 post with Postgresql. I have installed onto a Debian
 testing system,
 created a space for the database cluster on
 /usr/local/pgsql/data,
 changed owner to postgres and changed permissions to
 0700.
 
 However, when I try `initdb -D
 /usr/local/pgsql/data' I get Command not
 found
 
 I've googled for this but found nothing useful.
 
 Regards, John
 -- 
 War is God's way of teaching Americans geography
 Ambrose Bierce (1842 - 1914)
 
 ---(end of
 broadcast)---
 TIP 1: if posting/reading through Usenet, please
 send an appropriate
subscribe-nomail command to
 [EMAIL PROTECTED] so that your
message can get through to the mailing list
 cleanly
 



  __ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


[GENERAL] help with query...

2007-05-28 Thread marcelo Cortez
Folks

I am confused  ,
way planer it does not use the partial index? 
query:

  SELECT cliente_base.* FROM cliente_base
 WHERE (cliente_base.inst_class_ = 'Cliente' ) ORDER
BY cliente_base.nombre ASC


plan:

 QUERY PLAN 
---
 Sort  (cost=821.08..837.04 rows=6387 width=378)
(actual time=46.809..53.077 rows=6463 loops=1)
   Sort Key: nombre
   -  Seq Scan on cliente_base  (cost=0.00..417.39
rows=6387 width=378) (actual time=0.033..19.080
rows=6463 loops=1)
 Filter: ((inst_class_)::text =
'Cliente'::text)
 Total runtime: 58.280 ms
(5 rows)




any help be appreciated 

pd: sorry for my english.

data:
table definition:
-- Table: cliente_base

CREATE TABLE cliente_base
(
  id_ integer NOT NULL,
  activo boolean,
  numero integer,
  categ character varying(1),
  nombre character varying(40),
  renglon_1 character varying(40),
  renglon_2 character varying(25),
  renglon_3 character varying(15),
  pobox character varying(7),
  pais integer,
  estado character varying(2),
  att character varying(15),
  telefono_1 character varying(15),
  telefono_2 character varying(15),
  telex_1 character varying(10),
  web character varying(254),
  dominio character varying(30),
  email character varying(255),
  telecop character varying(15),
  tarifa character varying(1),
  doc_clase character varying(2),
  doc_nro character varying(8),
  caja_cod character varying(4),
  caja_nro character varying(10),
  fecha date,
  soc_nro integer,
  ganancia character varying(11),
  iva character varying(15),
  folio character varying(3),
  libro character varying(2),
  tomo character varying(2),
  reg_ind character varying(20),
  cuit character varying(15),
  carpeta_sn character varying(1),
  version_ integer,
  inst_class_ character varying(128),
  CONSTRAINT cliente_base_pkey PRIMARY KEY (id_)
) 
WITHOUT OIDS;
ALTER TABLE cliente_base OWNER TO postgres;


-- Index: i_cliente

-- DROP INDEX i_cliente;

CREATE INDEX i_cliente
  ON cliente_base
  USING btree
  (activo);

-- Index: ipartialagente

-- DROP INDEX ipartialagente;

CREATE INDEX ipartialagente
  ON cliente_base
  USING btree
  (numero)
  WHERE inst_class_::text = 'Agente'::text AND activo
= true;

-- Index: ipartialcliente

-- DROP INDEX ipartialcliente;

CREATE INDEX ipartialcliente
  ON cliente_base
  USING btree
  (numero)
  WHERE inst_class_::text = 'Cliente'::text AND activo
= true;

-- Index: ixclientebase

-- DROP INDEX ixclientebase;

CREATE INDEX ixclientebase
  ON cliente_base
  USING btree
  (nombre)
  WHERE inst_class_::text = 'Agente'::text;

-- Index: ixclientebase1

-- DROP INDEX ixclientebase1;

CREATE INDEX ixclientebase1
  ON cliente_base
  USING btree
  (nombre)
  WHERE inst_class_::text = 'Cliente'::text;

-- Index: ixclientebase2

-- DROP INDEX ixclientebase2;

CREATE INDEX ixclientebase2
  ON cliente_base
  USING btree
  (id_)
  WHERE inst_class_::text = 'Cliente'::text;

-- Index: ixmnombre

-- DROP INDEX ixmnombre;

CREATE INDEX ixmnombre
  ON cliente_base
  USING btree
  (activo, nombre);

-- Index: ixmnumero

-- DROP INDEX ixmnumero;

CREATE INDEX ixmnumero
  ON cliente_base
  USING btree
  (activo, numero);




For the record , i made some queries with statistics
proppuses 

 select count(*) from cliente_base;
 count
---
 11791
(1 row)


 select distinct activo  , count(*) from cliente_base
group by activo ;
 activo | count
+---
 f  |   310
 t  | 11481
(2 rows)


select distinct cliente_base.inst_class_ , count(*)
from cliente_base group by cliente_base.inst_class_
postgres-# ;
 inst_class_ | count
-+---
 Agente  |  5328
 Cliente |  6463
(2 rows)


  __ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 6: explain analyze is your friend


[GENERAL] help with query

2007-05-28 Thread marcelo Cortez
Folks

I am confused  ,
way planer it does not use the partial index? 

any help be appreciated 

pd: sorry for my english.

data:
table definition:
-- Table: cliente_base

CREATE TABLE cliente_base
(
  id_ integer NOT NULL,
  activo boolean,
  numero integer,
  categ character varying(1),
  nombre character varying(40),
  renglon_1 character varying(40),
  renglon_2 character varying(25),
  renglon_3 character varying(15),
  pobox character varying(7),
  pais integer,
  estado character varying(2),
  att character varying(15),
  telefono_1 character varying(15),
  telefono_2 character varying(15),
  telex_1 character varying(10),
  web character varying(254),
  dominio character varying(30),
  email character varying(255),
  telecop character varying(15),
  tarifa character varying(1),
  doc_clase character varying(2),
  doc_nro character varying(8),
  caja_cod character varying(4),
  caja_nro character varying(10),
  fecha date,
  soc_nro integer,
  ganancia character varying(11),
  iva character varying(15),
  folio character varying(3),
  libro character varying(2),
  tomo character varying(2),
  reg_ind character varying(20),
  cuit character varying(15),
  carpeta_sn character varying(1),
  version_ integer,
  inst_class_ character varying(128),
  CONSTRAINT cliente_base_pkey PRIMARY KEY (id_)
) 
WITHOUT OIDS;
ALTER TABLE cliente_base OWNER TO postgres;


-- Index: i_cliente

-- DROP INDEX i_cliente;

CREATE INDEX i_cliente
  ON cliente_base
  USING btree
  (activo);

-- Index: ipartialagente

-- DROP INDEX ipartialagente;

CREATE INDEX ipartialagente
  ON cliente_base
  USING btree
  (numero)
  WHERE inst_class_::text = 'Agente'::text AND activo
= true;

-- Index: ipartialcliente

-- DROP INDEX ipartialcliente;

CREATE INDEX ipartialcliente
  ON cliente_base
  USING btree
  (numero)
  WHERE inst_class_::text = 'Cliente'::text AND activo
= true;

-- Index: ixclientebase

-- DROP INDEX ixclientebase;

CREATE INDEX ixclientebase
  ON cliente_base
  USING btree
  (nombre)
  WHERE inst_class_::text = 'Agente'::text;

-- Index: ixclientebase1

-- DROP INDEX ixclientebase1;

CREATE INDEX ixclientebase1
  ON cliente_base
  USING btree
  (nombre)
  WHERE inst_class_::text = 'Cliente'::text;

-- Index: ixclientebase2

-- DROP INDEX ixclientebase2;

CREATE INDEX ixclientebase2
  ON cliente_base
  USING btree
  (id_)
  WHERE inst_class_::text = 'Cliente'::text;

-- Index: ixmnombre

-- DROP INDEX ixmnombre;

CREATE INDEX ixmnombre
  ON cliente_base
  USING btree
  (activo, nombre);

-- Index: ixmnumero

-- DROP INDEX ixmnumero;

CREATE INDEX ixmnumero
  ON cliente_base
  USING btree
  (activo, numero);


query:

  SELECT cliente_base.* FROM cliente_base
 WHERE (cliente_base.inst_class_ = 'Cliente' ) ORDER
BY cliente_base.nombre ASC


plan:

 QUERY PLAN 
---
 Sort  (cost=821.08..837.04 rows=6387 width=378)
(actual time=46.809..53.077 rows=6463 loops=1)
   Sort Key: nombre
   -  Seq Scan on cliente_base  (cost=0.00..417.39
rows=6387 width=378) (actual time=0.033..19.080
rows=6463 loops=1)
 Filter: ((inst_class_)::text =
'Cliente'::text)
 Total runtime: 58.280 ms
(5 rows)



For the record , i made some queries with statistics
proppuses 

 select count(*) from cliente_base;
 count
---
 11791
(1 row)


 select distinct activo  , count(*) from cliente_base
group by activo ;
 activo | count
+---
 f  |   310
 t  | 11481
(2 rows)


select distinct cliente_base.inst_class_ , count(*)
from cliente_base group by cliente_base.inst_class_
postgres-# ;
 inst_class_ | count
-+---
 Agente  |  5328
 Cliente |  6463
(2 rows)



 





  __ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [GENERAL] dns less connection

2007-05-16 Thread marcelo Cortez
Hi folks

Magnus thanks for respond, but i can't success full
with this.
Hi think it's string connection mater, but can't
connect, you try any time without pgsqlodbc 
installed?.
I'm  not using (vb) :D but using COM way.
Every time odcb reclaim for MS dont know default
driver or something like this, even psqlodb
installed.
Any suggestion will be appreciated?

best regards
MDC

--- Magnus Hagander [EMAIL PROTECTED] escribió:

 On Mon, May 14, 2007 at 08:46:23PM -0300, marcelo
 Cortez wrote:
  hi all  
  
   there any was successful with connect to postgres
  with psqlodbc in dsn less mode?  It's wrong list
 for
  this subject?  any pointer be appreciated
 
 Certainly, all the time. For example (unix people
 close your eyes, this is
 vbscript):
 
 dbconn.Open Driver={PostgreSQL
 UNICODE};DATABASE=admin;SERVER=my.server.se;uid= 
 wshshell.Environment(PROCESS)(USERNAME)
 
 //Magnus
 
 ---(end of
 broadcast)---
 TIP 9: In versions below 8.0, the planner will
 ignore your desire to
choose an index scan if your joining column's
 datatypes do not
match
 



  __ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [GENERAL] dns less connection

2007-05-16 Thread marcelo Cortez
Andreas ,Magnus 

 I do where you say me but...

' ''IM002: [Microsoft][ODBC Driver Manager] Data
source name not found and no default driver
specified''')
 i'm follow your instrutions and replace parts of
connectString but don't work .
Later a try with debugging options.
best regards

MDC

--- Andreas [EMAIL PROTECTED] escribió:

 
 There is actually an ODBC list vor PG availlable ;)
 
 
 The drivers name is   postgresql unicode
 orpostgresql ansidepending on your needs.
 
 Driver={PostgreSQL

UNICODE};DATABASE=X1;SERVER=X2;PORT=X3;UID=X4;PWD=X5;X6;
 
 This is the connection string but you have to
 replace
 X1  with the name of your database
 X2  .. server
 X3  your port ... ok this would probaply be 5432
 X4, X5   your PG-username and password
 X6  are ODBC parameters that you like to use e.g. 
 BoolsAsChar=0;TrueIsMinus1=1;RowVersioning=1;
 
 This works at least for ADODB.
 
 DAO had it like this:
 ODBC;Driver=PostgreSQL 

UNICODE;DATABASE=X1;SERVER=X2;PORT=X3;UID=X4;PWD=X5;X6;
 
 
 marcelo Cortez schrieb:
  Hi folks
 
  Magnus thanks for respond, but i can't success
 full
  with this.
  Hi think it's string connection mater, but can't
  connect, you try any time without pgsqlodbc 
  installed?.
  I'm  not using (vb) :D but using COM way.
  Every time odcb reclaim for MS dont know default
  driver or something like this, even psqlodb
  installed.
  Any suggestion will be appreciated?
 
  best regards
  MDC
 
  --- Magnus Hagander [EMAIL PROTECTED]
 escribió:
 

  On Mon, May 14, 2007 at 08:46:23PM -0300, marcelo
  Cortez wrote:
  
  hi all  
 
   there any was successful with connect to
 postgres
  with psqlodbc in dsn less mode?  It's wrong list

  for
  
  this subject?  any pointer be appreciated

  Certainly, all the time. For example (unix people
  close your eyes, this is
  vbscript):
 
  dbconn.Open Driver={PostgreSQL
  UNICODE};DATABASE=admin;SERVER=my.server.se;uid=
 
  wshshell.Environment(PROCESS)(USERNAME)
 
  //Magnus
 
  ---(end of
  broadcast)---
  TIP 9: In versions below 8.0, the planner will
  ignore your desire to
 choose an index scan if your joining
 column's
  datatypes do not
 match
 
  
 
 
 
   
 __ 
  Preguntá. Respondé. Descubrí. 
  Todo lo que querías saber, y lo que ni imaginabas,
  está en Yahoo! Respuestas (Beta). 
  ¡Probalo ya! 
  http://www.yahoo.com.ar/respuestas 
 
 
  ---(end of
 broadcast)---
  TIP 2: Don't 'kill -9' the postmaster
 

 
 
 ---(end of
 broadcast)---
 TIP 4: Have you searched our list archives?
 
http://archives.postgresql.org/
 



  __ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org/


[GENERAL] dns less connection

2007-05-14 Thread marcelo Cortez
hi all  

 there any was successful with connect to postgres
with psqlodbc in dsn less mode?  It's wrong list for
this subject?  any pointer be appreciated
best regards 
mdc


  __ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] Audit-trail engine: getting the application's layer user_id

2007-05-09 Thread Marcelo de Moraes Serpa

Hi Manuel,

Just replying to say a big thank you ... I compiled the C extension with the
code you , did all the necessary logic and finally solved it. Thank you very
much for your help!

Thank you also to all the other who helped me!

Marcelo.

On 4/24/07, Manuel Sugawara [EMAIL PROTECTED] wrote:


Marcelo de Moraes Serpa [EMAIL PROTECTED] writes:

 Hey guys,

 Mine is an web application - three tier. The app connects to the db
using
 only one user and it has it's own authentication system and doesn't
 rely on the database for user management.

I solved the problem using a C program and keeping all the information
in the database, that means, users, passwords and ``sessions''. Each
time a user opens a session the system register it in a table that
looks like:

auth.session
 Tabla «auth.session»
Columna|Tipo |
Modificadores

---+-+
id| integer | not null default nextval(('
auth.session_sid'::text)::regclass)
skey  | text| not null
agent_id  | integer | not null
host  | text| not null default
'localhost'::text
start_time| timestamp without time zone | not null default now()
end_time  | timestamp without time zone |
su_session_id | integer |
Índices:
«session_pkey» PRIMARY KEY, btree (id)
Restricciones de llave foránea:
«$1» FOREIGN KEY (agent_id) REFERENCES auth.agent(id)
«session_su_session_id_fkey» FOREIGN KEY (su_session_id) REFERENCES
auth.session(id)

Each time the application gets a connection from the pool it sets the
session id of that user in a static variable (that was the tricky
part) using a function set_session_id and then you can retrieve it
using another function current_session_id (nowadays I think that can
be done without C at all but using the new GUC infrastructure
). So you can put in your log table something like:


  session_id int not null default current_session_id() references
auth.session(id),


Finally before returning the connection to the pool the application
resets the session id of that user using reset_session_id. The code
is:

#include postgres.h

#include stdio.h
#include string.h
#include time.h
#include unistd.h
#include fmgr.h

static int session_id = 0;
static int session_id_is_set = false;

Datum set_session_id(PG_FUNCTION_ARGS);
Datum current_session_id(PG_FUNCTION_ARGS);
Datum reset_session_id(PG_FUNCTION_ARGS);

PG_FUNCTION_INFO_V1(set_session_id);
PG_FUNCTION_INFO_V1(current_session_id);
PG_FUNCTION_INFO_V1(reset_session_id);

Datum
set_session_id(PG_FUNCTION_ARGS) {
session_id = PG_GETARG_INT32(0);
session_id_is_set = true;
PG_RETURN_INT32(session_id);
}

Datum
current_session_id(PG_FUNCTION_ARGS) {
if (! session_id_is_set)
PG_RETURN_NULL();
PG_RETURN_INT32(session_id);
}

Datum
reset_session_id(PG_FUNCTION_ARGS) {
session_id_is_set = false;
PG_RETURN_BOOL(1);
}

Hope that helps.

Regards,
Manuel.



[GENERAL] Server specs to run PostgreSQL

2007-05-08 Thread MaRCeLO PeReiRA
Hi there,

Actually my PostgreSQL server is running on a Athlon
XP 1800+, 512Mb RAM, IDE Disks, 10/100 netcard.

I would like to buy a new server, could you please
give me some information about the specs??

Is it important to have a Dual (or even Quad)
processor??? Will PostgreSQL use them??

What about memory??? How much???

SCSI Disks and 10/100/1000 netcards, it's ok!! No
doubt!

It's a medium use server, about 3000 transactions/day.

Thanks in advance,
Marcelo Pereira

__
Fale com seus amigos  de graça com o novo Yahoo! Messenger 
http://br.messenger.yahoo.com/ 

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


[GENERAL] Protocol error. Session setup failed (PostgreSQL 8.3devel/postgresql-8.3dev-600.jdbc3)

2007-04-28 Thread Marcelo de Moraes Serpa

Hello,

I've built PostgreSQL 8.3 devel with VC++ 2005, done all the db
initialization process (creating the data dir using initdb, registering it
as a service using pg_ctl, etc) and tested by connecting to it through
pgAdmin III, I even built a C extension and ran it as a SP in the pgAdmin
SQL console.

I then restored a backup with the database of my under-development java
application in the hope that it would connect to this db transparently (I
have of course changed the jdbc driver to match the 8.3devel version).

When I tried to run my web java application, I received the following
PSQLException: Protocol error. Session setup failed

What could be happening?

Note: I've attached the tomcat stack trace to the error.

Thanks,

Marcelo.
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from 
fulfilling this request.

exception

javax.servlet.ServletException: org.postgresql.util.PSQLException: Erro de 
Protocolo. Configuração da sessão falhou.
at 
org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:470)
at 
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:98)
at 
org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at 
org.postgresql.jdbc2.AbstractJdbc2Connection.init(AbstractJdbc2Connection.java:125)
at 
org.postgresql.jdbc3.AbstractJdbc3Connection.init(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc3.Jdbc3Connection.init(Jdbc3Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:382)
at org.postgresql.Driver.connect(Driver.java:260)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.genexus.db.driver.GXConnection$1.run(Unknown Source)
at 
com.genexus.platform.NativeFunctions11.executeWithPermissions(Unknown Source)
at com.genexus.db.driver.GXConnection.connectJDBCDriver(Unknown Source)
at com.genexus.db.driver.GXConnection.connect(Unknown Source)
at com.genexus.db.driver.GXConnection.init(Unknown Source)
at com.genexus.db.driver.GXConnection.init(Unknown Source)
at 
com.genexus.db.driver.ReadWriteConnectionPool.createConnection(Unknown Source)
at com.genexus.db.driver.ConnectionPool.checkOut(Unknown Source)
at com.genexus.db.driver.DataSourceConnectionPool.checkOut(Unknown 
Source)
at com.genexus.db.ServerUserInformation.getConnection(Unknown Source)
at com.genexus.db.ServerDBConnectionManager.getConnection(Unknown 
Source)
at com.genexus.db.DefaultConnectionProvider.getConnection(Unknown 
Source)
at com.genexus.db.DataStoreProviderBase.getConnection(Unknown Source)
at com.genexus.db.SentenceProvider.getPreparedStatement(Unknown Source)
at com.genexus.db.ForEachCursor.preExecute(Unknown Source)
at com.genexus.db.DataStoreProvider.execute(Unknown Source)
at ppobtemmensagemsistema.execute_int(ppobtemmensagemsistema.java:49)
at ppobtemmensagemsistema.execute(ppobtemmensagemsistema.java:31)
at 
hhexibemensagemsessaoexpirada_impl.e1211Z2(hhexibemensagemsessaoexpirada_impl.java:335)
at 
hhexibemensagemsessaoexpirada_impl.strup11Z0(hhexibemensagemsessaoexpirada_impl.java:304)
at 
hhexibemensagemsessaoexpirada_impl.start11Z2(hhexibemensagemsessaoexpirada_impl.java:197)
at 
hhexibemensagemsessaoexpirada_impl.ws11Z2(hhexibemensagemsessaoexpirada_impl.java:202)
at 
hhexibemensagemsessaoexpirada_impl.webExecute(hhexibemensagemsessaoexpirada_impl.java:57)
at com.genexus.webpanels.GXWebObjectBase.doExecute(Unknown Source)
at 
hhexibemensagemsessaoexpirada.doExecute(hhexibemensagemsessaoexpirada.java:19)
at com.genexus.webpanels.GXWebObjectStub.callExecute(Unknown Source)
at com.genexus.webpanels.GXWebObjectStub.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at 
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419)
at 
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104

[GENERAL] Using a library compiled for 8.3 in 8.2

2007-04-27 Thread Marcelo de Moraes Serpa

Hello!

Today, I have finally managed to compile PostgreSQL 8.3devel using Visual
C++ 2005 on Windows XP PRO. It was a tough process as I've never hacked such
a big OS project like PGSQL. I did it becouse I needed to develop some C
functions that will be exported as functions to be called as Stored
Procedures. The dll compiled well, however, when I try to create it in the
database using the CREATE OR REPLACE FUNCTION, I get the following error
message:

ERROR: incompatible library C:\Arquivos de
programas\PostgreSQL\8.2\lib\sgipgfunc.dll: version mismatch
SQL state: XX000
Detail: Server is version 8.2, library is version 8.3.

How could I make it work with 8.2 without having to download the 8.2 source
code and compiling it? Is there a way to do that?

Thanks in advance,

Marcelo.


[GENERAL] postgres.exe - Entry point not found (PostgreSQL 8.3 devel)

2007-04-27 Thread Marcelo de Moraes Serpa

Hello,

I have compiled PostgreSQL 8.3devel using Microsoft Visual C++ 2005 but when
I tried to start it (either by using the initdb.exe or postgres.exe) I
receive the following error message:

Message title: postgres.exe - Entry point not found
Message body: It wasn't possible to find the entry point of the
xmlNewValidCtxt procedure in the libxml2.dll dynamic link library

However, everything compiled well and without errors (only some warning).

I would be grateful if someone could enlight me on this one.

Marcelo.


[GENERAL] WARNING Bison install not found, or unsupported Bison version.

2007-04-26 Thread Marcelo de Moraes Serpa

I'm trying to build PostgreSQL 8.2 on Windows XP PRO. I've already
downloaded and configured all the dependencies, including bison and flex.
However, when I try to make it I receive the following error:  WARNING
Bison install not found, or unsupported Bison version.
Attempting to build without. even though bison and flex are installed!
(the latest version from gnuwin32).

I'm trying to compile it with VS2005 (src/tools/msvc)

Any feedback would be much appreaciated,

Marcelo.


[GENERAL] Compiling PostgreSQL 8.2 on Windows using msvc2k5

2007-04-26 Thread Marcelo de Moraes Serpa

Hello!

I'd like to learn more about PostgreSQL (8.x) internal architecture so as to
build C extensions and Stored Procedures in C. I think that I nice way to
start is trying to compile PostgreSQL from the source. I'm on Windows XP
PRO. I've found this article:
http://developer.postgresql.org/pgdocs/postgres/x19444.html. I've downloaded
all the dependencies and have put them on C:\prog\pgsql\depend (I
discovered the default path was this the first time the compiler complained
about missing libs. Didn't find a way to change this path though.)

I have gone to /src/tools/msvc and ran build. However, I still receive tons
of errors and warnings.

My main doubt here is about the dependencies. I'm not used to the process of
compiling third party source code. I've checked out the cvs to get the
source rather than getting the source somewhere else. Does this cvs release
need all the dependencies listed on the article above or there is something
that is optional? Is there an easier way to get all these dependencies? I
didn't find instructions on where to put them (I discovered by accident that
the compiler expected them to be on C:\prog\pgsql\depend).

Note: I had to modify the pgbison.bat (commented the part where it checks
for the version 1.875) so it would run bison over the .y files.).

If anyone could put me on the right direction I would be grateful!


Re: [GENERAL] Audit-trail engine: getting the application's layer user_id

2007-04-25 Thread Marcelo de Moraes Serpa

Hey guys, I really appreaciate your help, thank you very much for your time.

@Manuel: What a comprehensive solution! Thanks a lot for that :)
@Joris: That would be a simpler althernative, I will try it out too!

Marcelo.

On 4/24/07, Joris Dobbelsteen [EMAIL PROTECTED] wrote:




 --
*From:* [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED] *On Behalf Of *Marcelo de Moraes Serpa
*Sent:* dinsdag 24 april 2007 21:06
*To:* pgsql-general@postgresql.org
*Subject:* Re: [GENERAL] Audit-trail engine: getting the application's
layer user_id

 Thank you for the replies.

@Richard: I've thought about having one DB user for each APP user.
However, a coworker told me that it would infeasible to do that on the web
enviroment, specifically for J2EE where a DB connection pool is used, so I
gave up on that.

As Richard mentioned, he has done it.
Remember, for the pool you DO NOT setup a new connection every time but
you can certainly utilize the pool. The trick is the postgresql idea of the
Role-Based Access Control (RBAC) implementation. I.e. you can just do a
SET LOCAL ROLE rolename.
After transaction commit or rollback, or execution of SET LOCAL ROLE
NONE or RESET ROLE you will have your original role (own user) again. This
should work just fine.

See also: http://www.postgresql.org/docs/8.1/interactive/sql-set-role.html

 @Jorge: Is this connection id you say equivalent to the applicationid
mentioned in the ibm db2 article? If so, how could I get this data through
my application?

On 4/24/07, Marcelo de Moraes Serpa [EMAIL PROTECTED] wrote:

 Thank you for the replies.

 @Richard: I've thought about having one DB user for each APP user.
 However, a coworker told me that it would infeasible to do that on the web
 enviroment, specifically for J2EE where a DB connection pool is used, so I
 gave up on that.

 @Jorge: Is this connection id you say equivalent to the
 applicationid mentioned in the ibm db2 article? If so, how could I get
 this data through my application?

 Marcelo.

 On 4/24/07, Jorge Godoy [EMAIL PROTECTED] wrote:
 
  Marcelo de Moraes Serpa [EMAIL PROTECTED] writes:
 
   I forgot to add the link to the article I've mentioned:
  
  
  
http://www-128.ibm.com/developerworks/db2/library/techarticle/0302stolze/0302stolze.html#section2b
  
   This is what I'd like to do on PostgreSQL,
 
  So, translating it to a simpler example:
 
  You want that your function gets the connection ID it is using and
  ties it to your current user ID at your application and then have
  all your tables use a trigger to retrieve the user name from the
  auxiliar table that maps connection ID - user, right?
 
  That's what's in that page: a UDF (user defined function) named
  getapplicationid() that will return the user login / name / whatever
  and
  triggers.
 
  What is preventing you from writing that?  What is your doubt with
  regards to how create that feature on your database?
 
 
 
  --
  Jorge Godoy  [EMAIL PROTECTED] 
 





Re: [GENERAL] Audit-trail engine: getting the application's layer user_id

2007-04-25 Thread Marcelo de Moraes Serpa

Hi Manuel, just a quick question: What C libraries do I need to compile this
function? Or better: Where can I find a reference manual about db stored
procedures written in C for PostgreSQL?

Thanks!

On 4/24/07, Manuel Sugawara [EMAIL PROTECTED] wrote:


Marcelo de Moraes Serpa [EMAIL PROTECTED] writes:

 Hey guys,

 Mine is an web application - three tier. The app connects to the db
using
 only one user and it has it's own authentication system and doesn't
 rely on the database for user management.

I solved the problem using a C program and keeping all the information
in the database, that means, users, passwords and ``sessions''. Each
time a user opens a session the system register it in a table that
looks like:

auth.session
 Tabla «auth.session»
Columna|Tipo |
Modificadores

---+-+
id| integer | not null default nextval(('
auth.session_sid'::text)::regclass)
skey  | text| not null
agent_id  | integer | not null
host  | text| not null default
'localhost'::text
start_time| timestamp without time zone | not null default now()
end_time  | timestamp without time zone |
su_session_id | integer |
Índices:
«session_pkey» PRIMARY KEY, btree (id)
Restricciones de llave foránea:
«$1» FOREIGN KEY (agent_id) REFERENCES auth.agent(id)
«session_su_session_id_fkey» FOREIGN KEY (su_session_id) REFERENCES
auth.session(id)

Each time the application gets a connection from the pool it sets the
session id of that user in a static variable (that was the tricky
part) using a function set_session_id and then you can retrieve it
using another function current_session_id (nowadays I think that can
be done without C at all but using the new GUC infrastructure
). So you can put in your log table something like:


  session_id int not null default current_session_id() references
auth.session(id),


Finally before returning the connection to the pool the application
resets the session id of that user using reset_session_id. The code
is:

#include postgres.h

#include stdio.h
#include string.h
#include time.h
#include unistd.h
#include fmgr.h

static int session_id = 0;
static int session_id_is_set = false;

Datum set_session_id(PG_FUNCTION_ARGS);
Datum current_session_id(PG_FUNCTION_ARGS);
Datum reset_session_id(PG_FUNCTION_ARGS);

PG_FUNCTION_INFO_V1(set_session_id);
PG_FUNCTION_INFO_V1(current_session_id);
PG_FUNCTION_INFO_V1(reset_session_id);

Datum
set_session_id(PG_FUNCTION_ARGS) {
session_id = PG_GETARG_INT32(0);
session_id_is_set = true;
PG_RETURN_INT32(session_id);
}

Datum
current_session_id(PG_FUNCTION_ARGS) {
if (! session_id_is_set)
PG_RETURN_NULL();
PG_RETURN_INT32(session_id);
}

Datum
reset_session_id(PG_FUNCTION_ARGS) {
session_id_is_set = false;
PG_RETURN_BOOL(1);
}

Hope that helps.

Regards,
Manuel.



Re: [GENERAL] Audit-trail engine: getting the application's layer user_id

2007-04-25 Thread Marcelo de Moraes Serpa

I'm sorry Manuel, but after some time trying to fully understand your
approach, I think I really don't have the required elements to do so.

How do you pass your application's usename to this table? Or you don't keep
the username at all?

Could you give a more concrete example? Maybe showing the spots on your
application where you called these functions and why?


At least, for the C shared library compiling on Windows, I think I'm
half-way done - I've found a really useful comment on a PostgreSQL manual
page teaching how to compile PostgreSQL modules under Windows - you can see
it here: http://www.postgresql.org/docs/8.0/interactive/xfunc-c.html

Thank you again.

Marcelo.


On 4/24/07, Manuel Sugawara [EMAIL PROTECTED] wrote:


Marcelo de Moraes Serpa [EMAIL PROTECTED] writes:

 Hey guys,

 Mine is an web application - three tier. The app connects to the db
using
 only one user and it has it's own authentication system and doesn't
 rely on the database for user management.

I solved the problem using a C program and keeping all the information
in the database, that means, users, passwords and ``sessions''. Each
time a user opens a session the system register it in a table that
looks like:

auth.session
 Tabla «auth.session»
Columna|Tipo |
Modificadores

---+-+
id| integer | not null default nextval(('
auth.session_sid'::text)::regclass)
skey  | text| not null
agent_id  | integer | not null
host  | text| not null default
'localhost'::text
start_time| timestamp without time zone | not null default now()
end_time  | timestamp without time zone |
su_session_id | integer |
Índices:
«session_pkey» PRIMARY KEY, btree (id)
Restricciones de llave foránea:
«$1» FOREIGN KEY (agent_id) REFERENCES auth.agent(id)
«session_su_session_id_fkey» FOREIGN KEY (su_session_id) REFERENCES
auth.session(id)

Each time the application gets a connection from the pool it sets the
session id of that user in a static variable (that was the tricky
part) using a function set_session_id and then you can retrieve it
using another function current_session_id (nowadays I think that can
be done without C at all but using the new GUC infrastructure
). So you can put in your log table something like:


  session_id int not null default current_session_id() references
auth.session(id),


Finally before returning the connection to the pool the application
resets the session id of that user using reset_session_id. The code
is:

#include postgres.h

#include stdio.h
#include string.h
#include time.h
#include unistd.h
#include fmgr.h

static int session_id = 0;
static int session_id_is_set = false;

Datum set_session_id(PG_FUNCTION_ARGS);
Datum current_session_id(PG_FUNCTION_ARGS);
Datum reset_session_id(PG_FUNCTION_ARGS);

PG_FUNCTION_INFO_V1(set_session_id);
PG_FUNCTION_INFO_V1(current_session_id);
PG_FUNCTION_INFO_V1(reset_session_id);

Datum
set_session_id(PG_FUNCTION_ARGS) {
session_id = PG_GETARG_INT32(0);
session_id_is_set = true;
PG_RETURN_INT32(session_id);
}

Datum
current_session_id(PG_FUNCTION_ARGS) {
if (! session_id_is_set)
PG_RETURN_NULL();
PG_RETURN_INT32(session_id);
}

Datum
reset_session_id(PG_FUNCTION_ARGS) {
session_id_is_set = false;
PG_RETURN_BOOL(1);
}

Hope that helps.

Regards,
Manuel.



Re: [GENERAL] Audit-trail engine: getting the application's layer user_id

2007-04-25 Thread Marcelo de Moraes Serpa

Hi Manuel,

each time the user sends a request I do more or less

the following:

Could a trigger be used to implement this ? Or are you doing this from the

application layer? My problem is that, like Til, I don't have full control
over my request cycle as I'm over a very high-level framework (Actually it
is an data-oriented application generator, called GeneXus).

Thanks,

Marcelo.


On 4/25/07, Manuel Sugawara [EMAIL PROTECTED] wrote:


Marcelo de Moraes Serpa [EMAIL PROTECTED] writes:

 I'm sorry Manuel, but after some time trying to fully understand your
 approach, I think I really don't have the required elements to do so.

 How do you pass your application's usename to this table? Or you don't
keep
 the username at all?

 Could you give a more concrete example? Maybe showing the spots on your
 application where you called these functions and why?

I keep my user-names (agents) in the database along with a hashed
version of their passphrases, when a user logs in I have a procedure
written in plpgsql that checks the provided passphrase against the one
in the database and if they match the user is granted a session, and
the a corresponding row inserted in the session table. I keep the user
information (the session id and a key) in the session of the web tier
(I'm using java servlets but the concept is the same for other
frameworks). Now, each time the user sends a request I do more or less
the following:

   retrieve from the web session the id of the session in the database
   request a fresh connection from the pool
   check if the session is still alive (if not throw an exception)
   set the session id of the user
   handle the user request
   reset the session id
   return the connection to the pool

The implementation details are left to the reader ;-). Hope that helps

Regards,
Manuel.



Re: [GENERAL] Audit-trail engine: getting the application's layer user_id

2007-04-25 Thread Marcelo de Moraes Serpa


I'm doing it form the application layer and I don't think it can be
done in the database layer, how the trigger will figure out which user
is doing the query?, It's the same problem you are trying to solve!



Duh! That is what happens when you start having high levels of caffeinne in
your blood and haven't had a good night sleep... thanks for putting me on
the track again.

I will study Tim's approach more. This thing got more complicated than I
thought it would be. At least I'm learning more about PostgreSQL internal
architecture.

Thank you for your help.

Marcelo.

On 4/25/07, Manuel Sugawara [EMAIL PROTECTED] wrote:


Marcelo de Moraes Serpa [EMAIL PROTECTED] writes:

 Hi Manuel,

 each time the user sends a request I do more or less the following:

 Could a trigger be used to implement this ? Or are you doing this from
the
 application layer?

I'm doing it form the application layer and I don't think it can be
done in the database layer, how the trigger will figure out which user
is doing the query?, It's the same problem you are trying to solve!

 My problem is that, like Til, I don't have full control over my
 request cycle as I'm over a very high-level framework (Actually it
 is an data-oriented application generator, called GeneXus).

Maybe you can use Til approach with temporal tables.

Regards,
Manuel.



Re: [GENERAL] Audit-trail engine: getting the application's layer user_id

2007-04-25 Thread Marcelo de Moraes Serpa

Hello all,

I know I may be asking too much, but I have a very limited C/C++ (as well as
PostgreSQL internal architecture) knowledge. I've tried compiling the C
source code Manuel sent as a PostgreSQL loadable module on Visual Studio
.NET 2003 (C++) without success (lots of missing identifiers, int Datum
redefinition and other things I didn't really understood). The comments in
the Postgres 8.0 manual didn't help much.

If anyone could put me on the right direction on how to write/build C/C++
PostgreSQL on the Windows platform (specifically Windows XP) I would be
grateful as I really need this thing working as soon as possible.

Thanks,

Marcelo.

On 4/25/07, Marcelo de Moraes Serpa [EMAIL PROTECTED] wrote:


I'm doing it form the application layer and I don't think it can be
 done in the database layer, how the trigger will figure out which user
 is doing the query?, It's the same problem you are trying to solve!


Duh! That is what happens when you start having high levels of caffeinne
in your blood and haven't had a good night sleep... thanks for putting me on
the track again.

I will study Tim's approach more. This thing got more complicated than I
thought it would be. At least I'm learning more about PostgreSQL internal
architecture.

Thank you for your help.

Marcelo.

On 4/25/07, Manuel Sugawara [EMAIL PROTECTED] wrote:

 Marcelo de Moraes Serpa [EMAIL PROTECTED] writes:

  Hi Manuel,
 
  each time the user sends a request I do more or less the following:
 
  Could a trigger be used to implement this ? Or are you doing this from
 the
  application layer?

 I'm doing it form the application layer and I don't think it can be
 done in the database layer, how the trigger will figure out which user
 is doing the query?, It's the same problem you are trying to solve!

  My problem is that, like Til, I don't have full control over my
  request cycle as I'm over a very high-level framework (Actually it
  is an data-oriented application generator, called GeneXus).

 Maybe you can use Til approach with temporal tables.

 Regards,
 Manuel.





[GENERAL] Audit-trail engine: getting the application's layer user_id

2007-04-24 Thread Marcelo de Moraes Serpa

Hey guys,

I needed to implement an audit trail engine and decided to do it on the
database layer.

I already have a basic but fully functional audit trail system implemented
on my PostgreSQL 8.2 server. It has been done using PL/PGSQL
and triggers and it works pretty well.

Here's what I need to do: Somehow save the user_id of the **application**
user who have done the update/delete action to the log row.

Mine is an web application - three tier. The app connects to the db using
only one user and it has it's own authentication system and doesn't
rely on the database for user management.

I've read an article on IBM's developer site which teaches how to do just
that (get the application's user id and save it the audit
row) using what they call the APPLICATION_ID which is an unique ID that DB2
assigns to the app when it connects to the database. A
relation table is then created to relate the user_id and application_id.
When the user logs in, a new record is created in this table, and,
as the application_id is available in the db enviroment to the procedural
languages, we can then go to this table and finally get the
user_id. Is there something like that in Postgres?

Thanks in advance!

Marcelo.


Re: [GENERAL] Audit-trail engine: getting the application's layer user_id

2007-04-24 Thread Marcelo de Moraes Serpa

I forgot to add the link to the article I've mentioned:

http://www-128.ibm.com/developerworks/db2/library/techarticle/0302stolze/0302stolze.html#section2b

This is what I'd like to do on PostgreSQL,

Thanks,

Marcelo.

On 4/24/07, Marcelo de Moraes Serpa [EMAIL PROTECTED] wrote:


Hey guys,

I needed to implement an audit trail engine and decided to do it on the
database layer.

I already have a basic but fully functional audit trail system implemented
on my PostgreSQL 8.2 server. It has been done using PL/PGSQL
and triggers and it works pretty well.

Here's what I need to do: Somehow save the user_id of the **application**
user who have done the update/delete action to the log row.

Mine is an web application - three tier. The app connects to the db using
only one user and it has it's own authentication system and doesn't
rely on the database for user management.

I've read an article on IBM's developer site which teaches how to do just
that (get the application's user id and save it the audit
row) using what they call the APPLICATION_ID which is an unique ID that
DB2 assigns to the app when it connects to the database. A
relation table is then created to relate the user_id and application_id.
When the user logs in, a new record is created in this table, and,
as the application_id is available in the db enviroment to the procedural
languages, we can then go to this table and finally get the
user_id. Is there something like that in Postgres?

Thanks in advance!

Marcelo.


Re: [GENERAL] Audit-trail engine: getting the application's layer user_id

2007-04-24 Thread Marcelo de Moraes Serpa

Thank you for the replies.

@Richard: I've thought about having one DB user for each APP user. However,
a coworker told me that it would infeasible to do that on the web
enviroment, specifically for J2EE where a DB connection pool is used, so I
gave up on that.

@Jorge: Is this connection id you say equivalent to the applicationid
mentioned in the ibm db2 article? If so, how could I get this data through
my application?

On 4/24/07, Marcelo de Moraes Serpa [EMAIL PROTECTED] wrote:


Thank you for the replies.

@Richard: I've thought about having one DB user for each APP user.
However, a coworker told me that it would infeasible to do that on the web
enviroment, specifically for J2EE where a DB connection pool is used, so I
gave up on that.

@Jorge: Is this connection id you say equivalent to the applicationid
mentioned in the ibm db2 article? If so, how could I get this data through
my application?

Marcelo.

On 4/24/07, Jorge Godoy [EMAIL PROTECTED] wrote:

 Marcelo de Moraes Serpa [EMAIL PROTECTED] writes:

  I forgot to add the link to the article I've mentioned:
 
 
 
http://www-128.ibm.com/developerworks/db2/library/techarticle/0302stolze/0302stolze.html#section2b
 
  This is what I'd like to do on PostgreSQL,

 So, translating it to a simpler example:

 You want that your function gets the connection ID it is using and
 ties it to your current user ID at your application and then have
 all your tables use a trigger to retrieve the user name from the
 auxiliar table that maps connection ID - user, right?

 That's what's in that page: a UDF (user defined function) named
 getapplicationid() that will return the user login / name / whatever and
 triggers.

 What is preventing you from writing that?  What is your doubt with
 regards to how create that feature on your database?



 --
 Jorge Godoy  [EMAIL PROTECTED]





[GENERAL] nedd help bytea encode

2007-04-20 Thread marcelo Cortez
folks 

 I need help
 my client application need to save rtf text format,
 i'm codding string data into bytea format by hand
 but without success need some body check this
 
input sample data:
'{\rtf1\ansi 
}'

output codding
'\\173\\134\\162\\164\\146\\061\\134\\141\\156\\163\\151\\040\\015\\012\\175'

 i'm rigth? 

 best regards 
MDC


  __ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [GENERAL] string fields helps

2007-04-17 Thread marcelo Cortez
Thanks  Tom!

 this works.
 best regards
 MDC
 

--- Tom Lane [EMAIL PROTECTED] escribió:

 Bill Moran [EMAIL PROTECTED] writes:
  marcelo Cortez [EMAIL PROTECTED] wrote:
  I need to save data on rtf format but , postgres 
  
  refuses to storage for backslah or character's 
  problem's   any idea or vice are welcomed  
 best
 
  You need to escape the data before you insert it. 
 This is language-
  dependant, but any language that has PostgreSQL
 libraries will have
  functions to escape text data.
 
 Also, given that his main problem seems to be with
 backslashes, using
 8.2 and setting standard_conforming_strings = on
 might help.  It's still
 the case that not using a proper escaping function
 will come back to
 haunt you someday, though.
 
   regards, tom lane
 
 ---(end of
 broadcast)---
 TIP 4: Have you searched our list archives?
 
http://archives.postgresql.org/
 



  __ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[GENERAL] string fields helps

2007-04-16 Thread marcelo Cortez
Folks  

  I need to save data on rtf format but , postgres   
refuses to storage for backslah or character's 
problem's   any idea or vice are welcomed   best
regards 
 mdc

pd: sample off data to save ( from postgres log)


 UPDATE plbrecord SET documentation =
'{\rtf1\ansi\deff0{\fonttbl{\f0\fnil Tahoma;}}
\viewkind4\uc1\pard\lang1033\f0\fs16
\par }
', version_ = 4 WHERE (plbrecord.id_ = 8 AND
plbrecord.version_ = 3 AND plbrecord.inst_class_ =
'EntityDataWindow')
LOG:  statement: COMMIT1
LOG:  statement: BEGIN
LOG:  statement: UPDATE plbrecord SET documentation =
'{\rtf1\ansi\deff0{\fonttbl{\f0\fnil Tahoma;}}
\viewkind4\uc1\pard\lang1033\f0\fs16   SELECT
PARAMETROS.PARAMETRO,
\par  
substr(to_char(PARAMETROS.F_VAL_PARAM,
''/MM/DD''), 1,10),
\par  
substr(to_char(PARAMETROS.F_ANUL_PARAM,''/MM/DD''),
1,10),
\par  PARAMETROS.VALOR1,
\par  PARAMETROS.VALOR2
\par FROM PARAMETROS
\par  )
\par
\par }
', version_ = 5 WHERE (plbrecord.id_ = 8 AND
plbrecord.version_ = 4 AND plbrecord.inst_class_ =
'EntityDataWindow')
LOG:  statement: COMMIT
LOG:  statement: BEGIN
LOG:  statement: UPDATE plbrecord SET documentation =
'{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0
Tahoma;}{\f1\fnil Tahoma;}}
\viewkind4\uc1\pard\lang1033\f0\fs18   SELECT
PARAMETROS.PARAMETRO,
\par  
substr(to_char(PARAMETROS.F_VAL_PARAM,
''/MM/DD''), 1,10),
\par  
substr(to_char(PARAMETROS.F_ANUL_PARAM,''/MM/DD''),
1,10),
\par  PARAMETROS.VALOR1,
\par  PARAMETROS.VALOR2
\par FROM PARAMETROS
\par  )
\par \f1\fs16
\par }



  __ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [GENERAL] PGSQL 8.2.3 Installation problem

2007-02-14 Thread marcelo Cortez
Magnus

  I have NTFS only , i don't have FAT partitions at
all.
 But the problem is not resolved.
 The install fail at create cluster for me.
 I set all permisions for user postgres.

 Binary manual installation .. make sense   i try .
 It has any  manual/instructions/links for that?

Best regards
 MDC



--- Magnus Hagander [EMAIL PROTECTED] escribió:

 The installer is not supported in a fat environment.
 you need to install the binaries manually for that.
 
 /Magnus
 
 --- Original message ---
 From: RPK [EMAIL PROTECTED]
 Sent: 2-14-'07,  5:14
 
 
  Paul,
 
  I installed on a Fat32 partition and gave the data
 directory path to an NTFS
  partition. I have not set any file permissions.
 Installing as a default
  postgres user.
 
 
  Paul Lambert-2 wrote:
  
   marcelo Cortez wrote:
   hi there
  
   same things occurs to me.
Any body install win32 version with success???
  
best regards
MDC
  
  
   --- RPK [EMAIL PROTECTED]
 escribió:
  
   When I run the setup of PGSQL 8.2.3, it
 displays
   error while initializing
   database cluster. Error displayed is: Failed
 to
   execute initdb. Unable to
   set file system permissions.
  
   I am installing on Windows XP SP2 with
   administrator log in.
   --
   View this message in context:
  
  

http://www.nabble.com/PGSQL-8.2.3-Installation-problem-tf3221486.html#a8947083
   Sent from the PostgreSQL - general mailing
 list
   archive at Nabble.com.
  
  
   ---(end of
   broadcast)---
   TIP 2: Don't 'kill -9' the postmaster
  
  
  
  

  


  
 __
   Preguntá. Respondé. Descubrí.
   Todo lo que querías saber, y lo que ni
 imaginabas,
   está en Yahoo! Respuestas (Beta).
   ¡Probalo ya!
   http://www.yahoo.com.ar/respuestas
  
  
   ---(end of
 broadcast)---
   TIP 3: Have you checked our extensive FAQ?
  
 
 http://www.postgresql.org/docs/faq
  
  
  
   I've installed it on my WinXP Professional SP2
 (32 bit) machine without
   error.
  
   Action start 6:33:07: SetPermissions.
   1: Setting filesystem permissions...
   Action ended 6:33:07: SetPermissions. Return
 value 1.
   MSI (s) (F4:44) [06:33:07:312]: Doing action:
 RunInitdb
   Action 6:33:07: RunInitdb. Initializing database
 cluster (this may take
   a minute or two)...
   Action start 6:33:07: RunInitdb.
   1: Initializing database cluster (this may take
 a minute or two)...
   Action ended 6:33:07: RunInitdb. Return value 1.
  
   I wasn't installing under administrator, did
 this under my own account
   and had the install create the 'postgres' user
 account.
  
   Perhaps something wrong with the default file
 permissions where you are
   installing Postgres. I assume Postgres creates
 directories that inherit
   the parent directory permissions. If you have
 given the parent
   restricted access, the 'postgres' user that PG
 runs under may not have
   access to those dirs.
  
   Only thing I can think of anyway, if not then I
 am not sure why you
   would be having a problem.
  
   Regards,
   Paul.
  
   --
   Paul Lambert
   Database Administrator
   AutoLedgers
  
   ---(end of
 broadcast)---
   TIP 9: In versions below 8.0, the planner will
 ignore your desire to
  choose an index scan if your joining
 column's datatypes do not
  match
  
  
 
  --
  View this message in context:

http://www.nabble.com/PGSQL-8.2.3-Installation-problem-tf3221486.html#a8964644
  Sent from the PostgreSQL - general mailing list
 archive at Nabble.com.
 
 
  ---(end of
 broadcast)---
  TIP 1: if posting/reading through Usenet, please
 send an appropriate
 subscribe-nomail command to
 [EMAIL PROTECTED] so that your
 message can get through to the mailing list
 cleanly
 
 
 ---(end of
 broadcast)---
 TIP 9: In versions below 8.0, the planner will
 ignore your desire to
choose an index scan if your joining column's
 datatypes do not
match
 







__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [GENERAL] PGSQL 8.2.3 Installation problem

2007-02-14 Thread marcelo Cortez
Paul

 Thanks for your time.
 the installer log say:

fixing permissions on existing directory C:/Archivos
de programa/PostgreSQL/8.2/data ... ok
creating subdirectories ... initdb: could not create
directory C:/Archivos de programa: File exists
initdb: removing contents of data directory
C:/Archivos de programa/PostgreSQL/8.2/data

note path is truncated in message ???
 file not exists i delete directory
 one more time thanks

 best regardsd 
  mdc


--- Paul Lambert [EMAIL PROTECTED]
escribió:

 marcelo Cortez wrote:
  Magnus
  
I have NTFS only , i don't have FAT partitions
 at
  all.
   But the problem is not resolved.
   The install fail at create cluster for me.
   I set all permisions for user postgres.
  
   Binary manual installation .. make sense   i try
 .
   It has any  manual/instructions/links for that?
  
  Best regards
   MDC
  
  
  
 
 Have you run the setup with the 'write detailed
 installation log to 
 postgresql-8.2.log in the current directory'
 checked?
 
 Can you paste the relevant bits of that log (which
 you can find in the 
 same directory as the installation file) into a
 message so more educated 
 persons can take a look?
 
 If it's a file system problem, I'd also suggest
 going to 
 http://www.sysinternals.com to their file and disk
 utilities, download 
 ntfilemon and run it to monitor file activity (HINT:
 Set the filter to 
 include only *postgres*, otherwise you will be
 flooded with information 
 relating to file system access from everything else
 on your server - and 
 turn on advanced output) that may show you more
 information about what 
 the error was from the file system point of view.
 
 -- 
 Paul Lambert
 Database Administrator
 AutoLedgers
 
 







__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


[GENERAL] missing FROM-clause

2007-02-13 Thread MaRCeLO PeReiRA
Hi guys,

I upgraded my PostgreSQL server (7.4 to 8.2) and now
all my reports refuse to run because the warning
missing FROM-clause.

How can I disable it, just to run as the old version??

I have tried:

# set add_missing_from to false

but, without success!! :(

The warning is still there!!

Thanks in advance,

Marcelo Pereira

__
Fale com seus amigos  de graça com o novo Yahoo! Messenger 
http://br.messenger.yahoo.com/ 

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org/


[GENERAL] missing FROM-clause (more)

2007-02-13 Thread MaRCeLO PeReiRA
Hi guys,

(1) I change postgresql.conf:

add_missing_from = off

(2) pg_ctl stop
(3) pg_ctl start

Without success!! The warning is still there!! :(

Any ideas

Thanks in advance,

Marcelo Pereira

__
Fale com seus amigos  de graça com o novo Yahoo! Messenger 
http://br.messenger.yahoo.com/ 

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] PGSQL 8.2.3 Installation problem

2007-02-13 Thread marcelo Cortez
hi there

same things occurs to me.
 Any body install win32 version with success???

 best regards
 MDC


--- RPK [EMAIL PROTECTED] escribió:

 
 When I run the setup of PGSQL 8.2.3, it displays
 error while initializing
 database cluster. Error displayed is: Failed to
 execute initdb. Unable to
 set file system permissions.
 
 I am installing on Windows XP SP2 with
 administrator log in.
 -- 
 View this message in context:

http://www.nabble.com/PGSQL-8.2.3-Installation-problem-tf3221486.html#a8947083
 Sent from the PostgreSQL - general mailing list
 archive at Nabble.com.
 
 
 ---(end of
 broadcast)---
 TIP 2: Don't 'kill -9' the postmaster
 







__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


[GENERAL] Help with install postgres 8.2 win32 version

2007-02-12 Thread marcelo Cortez
folks 

 I can't install postgresql on winxp profesional


 Installer fail ( creating cluster)
 Installer with out cluster . ok
 creating cluster on hand   .fail
 initdb 

The files belonging to this database system will be
owned by user postgres.
This user must also own the server process.

The database cluster will be initialized with locale
Spanish_Argentina.28605.

fixing permissions on existing directory C:/Archivos
de programa/PostgreSQL/8.2/data ... ok
creating subdirectories ... initdb: could not create
directory C:/Archivos de programa: File exists
initdb: removing contents of data directory
C:/Archivos de programa/PostgreSQL/8.2/data

ever error is File exists

Any clue?
 best regards
  MDC

 






__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [GENERAL] How to preserve characters with accent?

2007-02-11 Thread marcelo Cortez
Hi there



--- Peter Eisentraut [EMAIL PROTECTED] escribió:

 dfx wrote:
  I have some fiel name with character with accent
 (à, ò...) but when I
  make a plain backup of schema (file.sql) that
 characters are
  converted to strange sequence of two (or more?)
 characters.

 This sounds to me unicode character set ..
 best regards
  MDC
 
 You need to set your server and client encoding
 correctly.
 
 -- 
 Peter Eisentraut
 http://developer.postgresql.org/~petere/
 
 ---(end of
 broadcast)---
 TIP 3: Have you checked our extensive FAQ?
 
http://www.postgresql.org/docs/faq
 







__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org/


[GENERAL] win32 install fail

2007-02-10 Thread marcelo Cortez
oblfolks 

 I can't install postgresql on winxp profesional


 Installer fail ( creating cluster)
 Installer with out cluster . ok
 creating cluster on hand   .fail
 initdb 

The files belonging to this database system will be
owned by user postgres.
This user must also own the server process.

The database cluster will be initialized with locale
Spanish_Argentina.28605.

fixing permissions on existing directory C:/Archivos
de programa/PostgreSQL/8.2/data ... ok
creating subdirectories ... initdb: could not create
directory C:/Archivos de programa: File exists
initdb: removing contents of data directory
C:/Archivos de programa/PostgreSQL/8.2/data

ever error is File exists

Any clue?
 best regards
  MDC

 






__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [GENERAL] how to read bytea field

2007-01-24 Thread marcelo Cortez
Shoaib ,folks


 Yes i know, but if your define bytea field and store
 bytea in this field , decode don't work, because
 decode function has text parameter not bytea ,so
 how do that to read bytea field to text again? 
 
 what function convert  bytea to text?
 best regards 
  mdc


--- Shoaib Mir [EMAIL PROTECTED] escribió:

 This might help you:
 
 select encode(col1,'escape') from tblBytea;
 
 where col1 is of type bytea...
 
 -
 Shoaib Mir
 EnterpriseDB (www.enterprisedb.com)
 
 On 1/24/07, marcelo Cortez
 [EMAIL PROTECTED] wrote:
 
  folks
 
 
  help me ,i cant read bytea type field's.
  how to convert bytea to text or varchar ?
  when using bytea types?
  any clue be appreciated
  best regards
  mdc
 
 
 
 
 
 
 
  __
  Preguntá. Respondé. Descubrí.
  Todo lo que querías saber, y lo que ni imaginabas,
  está en Yahoo! Respuestas (Beta).
  ¡Probalo ya!
  http://www.yahoo.com.ar/respuestas
 
 
  ---(end of
 broadcast)---
  TIP 3: Have you checked our extensive FAQ?
 
 http://www.postgresql.org/docs/faq
 
 







__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


  1   2   >