Re: [SQL] problem using regexp_replace

2010-01-12 Thread gherzig
> On 2010-01-11, gher...@fmed.uba.ar wrote: > >> So, i come with this: >> SELECT regexp_replace( >> formato, E'{([^.]*)\.([a-zA-Z0-9]*)}, >> valores_sustitucion(ARRAY[E'\\1'::varchar,E'\\2'::varchar]), >> 'g') >> from table where id =1; > > select valores_sustitucion(ARRAY[E'\

Re: [SQL] problem using regexp_replace

2010-01-11 Thread gherzig
> On 2010-01-11, gher...@fmed.uba.ar wrote: > >> CREATE FUNCTION valores_sustitucion(valor_ingresado varchar[]) >> returns varchar >> as >> $$ >> select case >> $1[1] when 'Action_1' then >> (select descripcion from load_by_cod($1[2])) >> >>when 'Action_2' then (select descripcion from p

[SQL] problem using regexp_replace

2010-01-10 Thread gherzig
Hi all. Im having a hard time here. Really have no idea what is wrong here. Facing a special case of text substitution, i have to parse a column like this one: SELECT formato from table where id=1; {Action_1.842}{Action_2.921}[truncated] The numbers at the rigth of the period identifies an argum

Re: [SQL] dynamic OUT parameters?

2009-01-31 Thread gherzig
> gher...@fmed.uba.ar wrote: > >> Oh, that looks promising. I wrongly supposed that RETURNING SETOF RECORD >> forces the use of OUT parameters. I will give your idea a try. > > Tom Lane's point about using a refcursor is (unsurprisingly) a good one. > If you return a refcursor from your function, y

Re: [SQL] dynamic OUT parameters?

2009-01-30 Thread gherzig
> Gerardo Herzig wrote: > >> 1) There is a way to make a function returning "any amount of any type >> of arguments"? > > RETURNS SETOF RECORD > > The application must, however, know what columns will be output by the > function ahead of time and call it using an explicit column declaration > list.

Re: [SQL] trying to repair a bad header block

2008-10-30 Thread gherzig
> On Wed, Oct 29, 2008 at 7:24 PM, Scott Marlowe <[EMAIL PROTECTED]> > wrote: > > Oh, and to reply to myself and the original poster, you need to figure > out what's causing the pages to get damaged. IT's usually bad > hardware, then a buggy driver, then a buggy kernel / OS that can cause > it. R

Re: [SQL] trying to repair a bad header block

2008-10-30 Thread gherzig
> On Wed, Oct 29, 2008 at 6:36 PM, Tom Lane <[EMAIL PROTECTED]> wrote: >> "Scott Marlowe" <[EMAIL PROTECTED]> writes: >>> On Wed, Oct 29, 2008 at 4:23 PM, Tom Lane <[EMAIL PROTECTED]> wrote: If you can tolerate losing the data on that page, just zero out the entire 8K page. dd from /dev/

[SQL] trying to repair a bad header block

2008-10-29 Thread gherzig
Hi all. I've seen this searching in google. After a select on a table, i got this: ERROR: invalid page header in block 399 of relation "xxx" I read about a tool called pg_filedump, and after some searchs about its usage, i execute pg_filedump $PG_DATA/base/xx/1234 (1234 is the oid of table xxx) A

[SQL] specifying wal file size

2008-03-31 Thread gherzig
Hi dudes. Im trying to find out how to deal with this. I just receive a 1.2 MB wal file (may some 'windows home version' do that?), and obviosly, when i try to recovery from there, get the 'incorrect file size' error. Acording to the docs, wal file size can be changed at compile time. Not so bad, i

Re: [SQL] reading WAL files in python

2008-01-07 Thread gherzig
> > On Jan 7, 2008, at 7:19 AM, Gerardo Herzig wrote: > >> Hi all. Im having some fun trying to write my own replication >> system using python. I will use the postgres own WAL archiving to >> write the files, then my app will read them and do some stuff. As >> im not a C programmer, im stuck in t

Re: [SQL] foreign key pointing to diff schema?

2007-08-10 Thread gherzig
> On 8/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> Hi all. Can i make a FK who points a table in a different schema? Or >> this >> is implemented via a trigger by my own? > > Sure. just prefix the table name with the schemaname and a . > > create schema abc; > alter user me set search_p

[SQL] foreign key pointing to diff schema?

2007-08-10 Thread gherzig
Hi all. Can i make a FK who points a table in a different schema? Or this is implemented via a trigger by my own? Thanks! Gerardo ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail

Re: [SQL] index not being used. Why?

2007-03-09 Thread gherzig
Thanks all you guys. Indeed, populating the tables with 10.000 entrys make the things different, and now it uses all the indexes as i spect. It was just a matter of being pacient and loading more data to test it out and see. And, yes, i need to upgrade psql now. Actually the real server has an 8.2

Re: [SQL] best index for ~ ordering?

2007-03-06 Thread gherzig
Well, im wondering if is possible using LIKE '%blah%', even better would be upper/lower(string) like '%blah%', Im not at work right now, i will try it latter and makes you know about the results of using tsearch indexing. Thanks a lot, man! Gerardo > On Tue, Mar 06, 2007 at 06:34:23PM -0300, Gera

Re: [SQL] refer a column as a varible name?

2005-09-13 Thread gherzig
Im using pg 8.0. I personally dont have problem in using pl/perl, but none of my companions is a perl programmer, so i guess the IF..THEN seems to be an easy (altough not preferable) solution. Thank you very much Michael. Gerardo > On Mon, Sep 12, 2005 at 12:21:22PM -0300, [EMAIL PROTECTED] wrote

[SQL] refer a column as a varible name?

2005-09-12 Thread gherzig
Hi all. I have troubles trying to achieve this assignment: suppose the type mycolumn as (field1, varchar, field2 varchar) and field_name = ''field1'' and returnValue declared as mycolumn ... can i say returnValue.$field_name = ''ok''? There is a way to achieve this piece of code? Thanks a lot!

Re: [SQL] [SOT] pypgsql function receiving dictionary as parameter?

2005-08-19 Thread gherzig
Suppose this python structure: someDict = { 'field1': 'Foo', 'creepyfield': 'Bar' } and the connection to the database CONN = pg.connect() I want some pypgslq function CREATE myfunction ( __dictionary__) returns void AS (process) LANGUAGE pythonu an

[SQL] [SOT] pypgsql function receiving dictionary as parameter?

2005-08-19 Thread gherzig
Hi all. Im a python programer, and im trying to use a dictionary (associative array on Perl) in my pypgsql function without result. Anybody know if it is possible? Thanks a lot folks. -- Gerardo Herzig Direccion General de Organizacion y Sistemas Facultad de Medicina U.B.A. -

Re: [SQL] calling EXECUTE on any exception

2005-07-29 Thread gherzig
Oh...to bad...Thank you Michael! Did someone know if it can be acomplished in pypgsql? Thanks againg falks. Gerardo > On Fri, Jul 29, 2005 at 10:36:52AM -0300, [EMAIL PROTECTED] wrote: >> EXCEPTION >> WHEN OTHER THEN >> EXECUTE exception_handler(Exception_code) >> >> how do i get that error_

[SQL] calling EXECUTE on any exception

2005-07-29 Thread gherzig
Hi all: I want to call some FUNCTION , let say exception_hanler(Exception_code) for any exception in plsql functions. I give some pseudo code to explain myself better: CREATE FUNCION something(...) returns ... AS ' ... EXCEPTION WHEN OTHER THEN EXECUTE exception_handler(Exception_code) ...