psql & query string length

From: "Ansley, Michael" <Michael(dot)Ansley(at)intec(dot)co(dot)za>
To: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: psql & query string length
Date: 1999-07-21 08:04:39
Message-ID: 1BF7C7482189D211B03F00805F8527F70ED072@S-NATH-EXCH2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Well, I got psql to do it's thing, eventually. I've tested it for pretty
much everything, including \e, \g, \r, \i.
The one problem that I have had is that after about the third '\i long.sql',
I get a core dump, because sprintf moaned about string size complications.
The way I have structured it, memory is reallocated (re- malloc'd, not
realloc'd) every time the query is extended. I suspect that this is very
inefficient, and probably causing the system to hooch after loading long.sql
three times. The main thought that I have had is to extend the query buffer
in blocks of about 8k or 16k. I presume that once working with set memory
sizes, the memory usage will be substantially more efficient. Ideas?

Also, what's the deal with realloc? I tried it a couple of times, but it
really screwed me around (hence the re- malloc'ing). Or is it just a Bad
Move to use realloc?

MikeA

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Broytmann 1999-07-21 10:57:01 RECODE patches
Previous Message Thomas Lockhart 1999-07-21 06:20:22 Re: [HACKERS] Another reason to redesign querytree representation