Re: [GENERAL] Query optimization

2014-10-29 Thread Jorge Arevalo
On Wed, Oct 29, 2014 at 8:47 PM, David Johnston wrote: > On Wed, Oct 29, 2014 at 12:14 PM, Jorge Arevalo > wrote: > >> >> SELECT value1,value2,value3,value4, value5, hstore(ARRAY['field9', >> 'field10', 'field11', 'field12'

Re: [GENERAL] Query optimization

2014-10-29 Thread Jorge Arevalo
On Wed, Oct 29, 2014 at 8:05 PM, David Johnston wrote: > On Wed, Oct 29, 2014 at 11:53 AM, Tom Lane wrote: > >> Jorge Arevalo writes: >> >> > This is the result of EXPLAIN ANALYZE >> >> >

Re: [GENERAL] Query optimization

2014-10-29 Thread Jorge Arevalo
s would be better as a composite type > instead > of an array. You may find it useful to use named composite types elsewhere > too... > > David J. > > > > > -- > View this message in context: > http://postgresql.1045698.n5.nabble.com/Query-optimization-tp5824739p5

[GENERAL] Query optimization

2014-10-28 Thread Jorge Arevalo
problem is I don't have access to Postgres configuration, in order to increase the timeout for user queries. And anyway, I don't think that increasing the timeout is a real solution (It'll just make the server suffer for more time). So, is there anything obviously wrong with my query

Re: [GENERAL] Connecting with PostgreSQL 9.1 using the Ubuntu machine user and peer authentication method

2014-08-08 Thread Jorge Arevalo
On Thu, Aug 7, 2014 at 3:43 PM, Adrian Klaver wrote: > On 08/07/2014 01:39 AM, Jorge Arevalo wrote: > > >> What OS are you on? >> >> Per: >> http://www.postgresql.org/__docs/9.1/interactive/auth-__ >> methods.html#AUTH-PEER >> >>

Re: [GENERAL] Connecting with PostgreSQL 9.1 using the Ubuntu machine user and peer authentication method

2014-08-07 Thread Jorge Arevalo
On Thu, Aug 7, 2014 at 1:08 AM, John R Pierce wrote: > On 8/6/2014 3:43 PM, Jorge Arevalo wrote: > >> >> I want to connect to my local installation of PostgreSQL 9.1 using my >> machine user (who is vagrant). So, after reading PostgreSQL documentation, >&

Re: [GENERAL] Connecting with PostgreSQL 9.1 using the Ubuntu machine user and peer authentication method

2014-08-07 Thread Jorge Arevalo
On Thu, Aug 7, 2014 at 1:14 AM, Adrian Klaver wrote: > On 08/06/2014 03:43 PM, Jorge Arevalo wrote: > >> Hello, >> >> I want to connect to my local installation of PostgreSQL 9.1 using my >> machine user (who is vagrant). So, after reading PostgreSQL >> docum

[GENERAL] Connecting with PostgreSQL 9.1 using the Ubuntu machine user and peer authentication method

2014-08-06 Thread Jorge Arevalo
ing. I asked this in serverfault too, but I think this is the right place) -- Jorge Arevalo http://about.me/jorgeas80

[GENERAL] SRF crash when calling SRF_RETURN_DONE

2010-05-20 Thread Jorge Arevalo
Hello, I have a problem with a SRF. In the first call, another external function is called. This function returns some allocated memory, and allocate/free more memory during its execution (I think there's no memory leaks in it...). Before calling the function, I change to a memory context appropia

Re: [GENERAL] Dynamic SQL with pgsql, how to?

2010-05-03 Thread Jorge Arevalo
On Mon, May 3, 2010 at 10:44 AM, Andre Lopes wrote: > Hi, > > I need to write some dynamic SQL in pgsql. > > I have to do something like this: > > [code=SQL Server] >     SET @STRINGN = @STRINGN + ' AND A.' + @CAMPOFECINI + ' IN (SELECT > MAX(B.' + @CAMPOFECINI + ') >             FROM ' + @TABLA +

Re: [GENERAL] Writing SRF

2010-04-30 Thread Jorge Arevalo
rom: jorgearev...@gis4free.org >> Date: Thu, 29 Apr 2010 19:45:41 +0200 >> Subject: Re: [GENERAL] Writing SRF >> To: t...@sss.pgh.pa.us >> CC: pgsql-general@postgresql.org >> >> On Thu, Apr 29, 2010 at 3:56 PM, Tom Lane wrote: >> > Jorge Arevalo writes:

Re: [GENERAL] Writing SRF

2010-04-30 Thread Jorge Arevalo
On Thu, Apr 29, 2010 at 8:03 PM, Tom Lane wrote: > Jorge Arevalo writes: >> Many thanks! That was one of my errors. Another one was this: > >> char szDataPointer[10]; >> sprintf(szDataPointer, "%p", a_pointer); > >> These lines caused a memory error.

Re: [GENERAL] Writing SRF

2010-04-29 Thread Jorge Arevalo
On Thu, Apr 29, 2010 at 3:56 PM, Tom Lane wrote: > Jorge Arevalo writes: >> Yes. For example, the function expects 2 arguments, and it's called >> with 2 arguments: 1 composite type (following this format >> https://svn.osgeo.org/postgis/spike/wktraster/doc/RFC1-Se

Re: [GENERAL] Writing SRF

2010-04-29 Thread Jorge Arevalo
On Wed, Apr 28, 2010 at 10:43 PM, Tom Lane wrote: > Jorge Arevalo writes: >> My doubt is if I'm doing things right getting all the stuff I need (an >> array) in the first call, pointing user_fctx to this array and >> accessing myStructsArray[call_cntr] in e

Re: [GENERAL] Writing SRF

2010-04-28 Thread Jorge Arevalo
On Wed, Apr 28, 2010 at 7:00 PM, Tom Lane wrote: > Jorge Arevalo writes: >> I'm writing a SRF following the example from >> http://www.postgresql.org/docs/8.4/interactive/xfunc-c.html (section >> 34.9.10). In the example, in the code executed in first call, we get >

[GENERAL] Writing SRF

2010-04-28 Thread Jorge Arevalo
Hello, I'm writing a SRF following the example from http://www.postgresql.org/docs/8.4/interactive/xfunc-c.html (section 34.9.10). In the example, in the code executed in first call, we get the number of tuples to be returned, and no more. Then, in each call, a new tuple is allocated and returned,

Re: [GENERAL] Unable to run createlang (or psql for that matter)

2010-04-26 Thread Jorge Arevalo
On Sun, Apr 25, 2010 at 11:08 AM, John Gage wrote: > If I open a bash terminal and type createlang -l, I get: > > JohnGage:~ johngage$ createlang -l > -bash: createlang: command not found > JohnGage:~ johngage$ psql > -bash: psql: command not found > > as one can see, the same thing happens with p

Re: [GENERAL] Showing debug messages in my C function

2010-04-16 Thread Jorge Arevalo
on crash. Thanks and sorry for being annoying. On Fri, Apr 16, 2010 at 12:51 PM, Jorge Arevalo wrote: > On Thu, Apr 15, 2010 at 8:16 PM, Jorge Arevalo > wrote: >> On Tue, Apr 13, 2010 at 10:04 PM, Tom Lane wrote: >>> Jorge Arevalo writes: >>>> I'm sorry, bec

Re: [GENERAL] Showing debug messages in my C function

2010-04-15 Thread Jorge Arevalo
On Tue, Apr 13, 2010 at 10:04 PM, Tom Lane wrote: > Jorge Arevalo writes: >> I'm sorry, because this may be a simple question: I'm programming a C >> function that returns a set (PostgreSQL 8.4). The function crash, and >> I'm trying to >> debug it. I&#x

[GENERAL] Showing debug messages in my C function

2010-04-12 Thread Jorge Arevalo
Hello, I'm sorry, because this may be a simple question: I'm programming a C function that returns a set (PostgreSQL 8.4). The function crash, and I'm trying to debug it. I've read: http://www.postgresql.org/docs/8.4/interactive/xfunc-c.html http://www.postgresql.org/docs/8.4/interactive/error-me

Re: [GENERAL] C-language functions: SRF question

2010-04-08 Thread Jorge Arevalo
On Thu, Apr 8, 2010 at 6:18 PM, Merlin Moncure wrote: > On Thu, Apr 8, 2010 at 11:40 AM, Jorge Arevalo > wrote: >> Is this a good way of doing it? Is it possible? And another small >> question: if the memory for my array of structs is allocated inside >> the function th

[GENERAL] C-language functions: SRF question

2010-04-08 Thread Jorge Arevalo
Hello, I need to code a set-returning function, but it's my first time, and I'm not sure if my point is the right one. I'd like to know your opinion: My function will return an array of structs. Then, In the first call (SRF_IS_FIRSTCALL() is true), I get the array from another function. For the n