Re: [HACKERS] Hash support for arrays

2010-11-02 Thread Sam Mason
On Sat, Oct 30, 2010 at 01:01:44PM -0400, Tom Lane wrote: > marcin mank writes: > > This is what boost does: > > http://www.systomath.com/include/Boost-1_34/doc/html/boost/hash_combine.html > > Hmm. I am reminded of Knuth's famous dictum: "never generate random > numbers with a method chosen at

Re: [HACKERS] W3C Specs: Web SQL

2010-11-09 Thread Sam Mason
On Mon, Nov 08, 2010 at 12:55:22PM -0300, Alvaro Herrera wrote: > Excerpts from Charles Pritchard's message of sáb nov 06 23:20:13 -0300 2010: > > > Simple async sql sub-set (the spec in trouble): > > http://dev.w3.org/html5/webdatabase/ > > This is insane. This spec allows the server to run arb

Re: [HACKERS] Specification for Trusted PLs?

2010-05-28 Thread Sam Mason
On Thu, May 27, 2010 at 11:09:26PM -0400, Tom Lane wrote: > David Fetter writes: > > I don't know about a *good* idea, but here's the one I've got. > > > 1. Make a whitelist. This is what needs to work in order for a > > language to be a fully functional trusted PL. > > Well, I pretty much los

Re: [HACKERS] Query optimization problem

2010-07-21 Thread Sam Mason
On Tue, Jul 20, 2010 at 09:57:06AM +0400, Zotov wrote: > SELECT d1.ID, d2.ID > FROM DocPrimary d1 >JOIN DocPrimary d2 ON d2.BasedOn=d1.ID > WHERE (d1.ID=234409763) or (d2.ID=234409763) You could try rewriting it to: SELECT d1.ID, d2.ID FROM DocPrimary d1 JOIN DocPrimary d2 ON

[HACKERS] Javascript support in the backend, i.e. PL/JS

2007-11-16 Thread Sam Mason
Hi All, I've been writing some code[1] to support Javascript in the backend. I've got the basic bits working, the next job for me is implementing SPI support. Currently, it runs simple bits of code like the following: CREATE FUNCTION jsinc(n INTEGER) RETURNS INTEGER LANGUAGE pljs AS $$ ret

Re: [HACKERS] Javascript support in the backend, i.e. PL/JS

2007-11-16 Thread Sam Mason
On Fri, Nov 16, 2007 at 09:20:37AM +0100, Pavel Stehule wrote: > On 16/11/2007, Sam Mason <[EMAIL PROTECTED]> wrote: > > Hi All, > > > > I've been writing some code[1] to support Javascript in the backend. > > I've got the basic bits working, the next

Re: [HACKERS] Javascript support in the backend, i.e. PL/JS

2007-11-16 Thread Sam Mason
On Fri, Nov 16, 2007 at 12:05:02PM +0100, Andreas Joseph Krogh wrote: > On Friday 16 November 2007 11:29:09 Sam Mason wrote: > [snip] > > SP? > > Stored Procedure That was kind of obvious wasn't it! I failed to parse that because of the "an" before it; "

Re: [HACKERS] Javascript support in the backend, i.e. PL/JS

2007-11-16 Thread Sam Mason
On Fri, Nov 16, 2007 at 10:56:55AM -0500, Tom Lane wrote: > Sam Mason <[EMAIL PROTECTED]> writes: > > For SPI, I'm thinking that I'd currently like to attempt some object > > orientated style interface. ... > > So running some SQL would probably look

Re: [HACKERS] Javascript support in the backend, i.e. PL/JS

2007-11-16 Thread Sam Mason
On Fri, Nov 16, 2007 at 09:49:38AM +0100, Andreas Joseph Krogh wrote: > Most people, as you probably know, don't like JS as a language 'cause they > think of it as a "web-browser language with lots of bad side-effects", but > that's 'cause they don't know the language, really. Javascript is a ve

Re: [HACKERS] Terminal width for help output

2007-11-19 Thread Sam Mason
On Thu, Nov 15, 2007 at 06:56:06PM -0300, Alvaro Herrera wrote: > Peter Eisentraut wrote: > > Do we care to maintain a maximum width for programs' --help output (and > > psql's > > \?)? I think 79 characters was once a recommendation (or perhaps 72), but > > we > > have a couple of violations

Re: [HACKERS] Sorting Improvements for 8.4

2007-11-28 Thread Sam Mason
On Tue, Nov 27, 2007 at 06:03:46PM +, Simon Riggs wrote: > Just wanted to review a few thoughts and ideas around improving external > sorts, as recently encouraged to do by Jim Nasby. Is there any way of PG knowing that having an index on a subset of the sorted columns is sometimes a win? Fo

Re: [HACKERS] PostGreSQL and recursive queries...

2007-11-30 Thread Sam Mason
[ I'm not very sure of my WITH RECURSIVE syntax, so please excuse any mistakes ] On Fri, Nov 30, 2007 at 01:00:27PM +, Gregory Stark wrote: > Hopefully at the cte call sites we'll be able to gin up enough information to > fill in the subquery information enough for the planner above to wor

[HACKERS] foreign keys

2007-12-12 Thread Sam Mason
Hi, How hard/generally useful would it be to allow the target of a foreign key to be on a set of columns where only a subset of them actually have a unique constraint. For example: CREATE TABLE base ( id INTEGER NOT NULL PRIMARY KEY, type INTEGER NOT NULL ); CREATE TABLE type1in

Re: [HACKERS] concurrency in psql

2008-01-01 Thread Sam Mason
On Tue, Jan 01, 2008 at 01:02:42PM +, kenneth d'souza wrote: > I am trying to understand concurrency and mvcc with a small example in > psql. I don't think your example below really shows MVCC working. MVCC is a behind the scenes implementation detail that if you're just typing SQL commands y

Re: [HACKERS] Dynamic Partitioning using Segment Visibility Maps

2008-01-02 Thread Sam Mason
On Wed, Jan 02, 2008 at 05:56:14PM +, Simon Riggs wrote: > Like it? Sounds good. I've only given it a quick scan though. Would read-only segments retain the same disk-level format as is currently? It seems possible to remove the MVCC fields and hence get more tuples per page--- whether this

Re: [HACKERS] VACUUM FULL out of memory

2008-01-08 Thread Sam Mason
On Tue, Jan 08, 2008 at 12:33:34PM -0500, Tom Lane wrote: > Andrew Sullivan <[EMAIL PROTECTED]> writes: > > On one system I used many years ago, /bin/sh wasn't what I thought it was, > > and so the ulimit that I got when logged in was not what the postmaster was > > starting under. Took me many da

Re: [HACKERS] Polyphase Merge

2008-01-21 Thread Sam Mason
On Mon, Jan 21, 2008 at 07:42:24PM +0100, [EMAIL PROTECTED] wrote: > During run creations I use two heaps instead of just one (yeah, > it's still me... the one of the two heaps still trying to get some > answer/help from -hackers) Hi again! > ISSUES > a) how to distribute logical runs (that is bo

Re: [HACKERS] Polyphase Merge

2008-01-22 Thread Sam Mason
On Mon, Jan 21, 2008 at 04:13:32PM -0500, Tom Lane wrote: > Sam Mason <[EMAIL PROTECTED]> writes: > > It's really up to you to find answers to these questions, especially > > the first one. Once you've designed an efficient algorithm then the > > second point

Re: [HACKERS] wishlist for 8.4

2008-02-15 Thread Sam Mason
On Thu, Feb 14, 2008 at 11:06:42AM -0500, Tom Lane wrote: > =?UTF-8?B?UmFwaGHDq2wgSmFjcXVvdA==?= <[EMAIL PROTECTED]> writes: > > so, I propose the use of > > NEW[variable_containing_the_column_name] > > (which can obviously be extended to any tuples) > > to allow such access. > > > what do you

Re: [HACKERS] Block-level CRC checks

2008-10-01 Thread Sam Mason
On Wed, Oct 01, 2008 at 11:57:31AM -0400, Alvaro Herrera wrote: > Tom Lane escribió: > > "Jonah H. Harris" <[EMAIL PROTECTED]> writes: > > > > I probably wouldn't compare checksumming *every* WAL record to a > > > single block-level checksum. > > > > No, not at all. Block-level checksums would b

Re: [HACKERS] array_agg and array_accum (patch)

2008-10-31 Thread Sam Mason
On Thu, Oct 30, 2008 at 11:19:15PM -0700, Jeff Davis wrote: > If there are potential problems with the standard > (where we don't want to implement a violation), we should just do > array_accum(). If not, we might as well do the standard array_agg(), > perhaps without the ORDER BY clause. I've wan

Re: [HACKERS] Question about SPI_prepare

2008-11-11 Thread Sam Mason
On Tue, Nov 11, 2008 at 11:33:41AM -0600, Tim Keitt wrote: > I have an application where I am building a plan with SPI_plan and > then this plan is called multiple times. There is one free parameter > ($1) to the plan. The issue is with the order of the values returned. > If $1 is identical during

Re: [HACKERS] So what's an "empty" array anyway?

2008-11-12 Thread Sam Mason
On Wed, Nov 12, 2008 at 09:46:09AM -0500, Robert Haas wrote: > The || operator is valid only if the dimensions > of the two arrays are equal (in which case it appends them) or if the > dimension of one of the arrays is one less than the other (in which > case, if legal, it treats the array of lesse

Re: [HACKERS] So what's an "empty" array anyway?

2008-11-12 Thread Sam Mason
On Wed, Nov 12, 2008 at 02:12:19PM +0200, Peter Eisentraut wrote: > Tom Lane wrote: > >Seems like we ought to clean this up. I'm not sure which way to jump > >though: should we decree that arrays of no elements must always have > >zero dimensions, or should we get rid of that and standardize on, s

Re: [HACKERS] is any reason why only one columns subselect are allowed in array()?

2008-11-18 Thread Sam Mason
On Tue, Nov 18, 2008 at 07:37:44AM -0800, David Fetter wrote: > On Tue, Nov 18, 2008 at 10:29:53AM -0500, Robert Haas wrote: > > Seems like you could just write SELECT ARRAY[col1, col2, col3] > > instead of SELECT col1, col2, col3. > > If I understand this right, Pavel is thinking that > > AR

Re: [HACKERS] is any reason why only one columns subselect are allowed in array()?

2008-11-18 Thread Sam Mason
On Tue, Nov 18, 2008 at 05:20:27PM +0100, Pavel Stehule wrote: > 2008/11/18 Sam Mason <[EMAIL PROTECTED]>: > > I've used this syntax before and got a surprising message back. I'd > > expect to be able to do the following: > > > > ARRAY((SELECT col1,

Re: [HACKERS] is any reason why only one columns subselect are allowed in array()?

2008-11-18 Thread Sam Mason
On Tue, Nov 18, 2008 at 05:19:12PM +0100, Pavel Stehule wrote: > there are some not necessary limits, because we should some operations: > > postgres=# select array(select * from foo); > ERROR: subquery must return only one column > LINE 1: select array(select * from foo); The current limitation

Re: [HACKERS] is any reason why only one columns subselect are allowed in array()?

2008-11-18 Thread Sam Mason
On Tue, Nov 18, 2008 at 06:55:26PM +0100, Pavel Stehule wrote: > 2008/11/18 Sam Mason <[EMAIL PROTECTED]>: > > On Tue, Nov 18, 2008 at 05:20:27PM +0100, Pavel Stehule wrote: > >> 2008/11/18 Sam Mason <[EMAIL PROTECTED]>: > >> > I've used this syntax

Re: [HACKERS] is any reason why only one columns subselect are allowed in array()?

2008-11-18 Thread Sam Mason
On Tue, Nov 18, 2008 at 06:22:21PM +, Sam Mason wrote: > I've always been taught to design things so that the that the basic > semantics should be as simple as possible which maintaining useful this should of course be "while"! ^ > performan

Re: [HACKERS] is any reason why only one columns subselect are allowed in array()?

2008-11-18 Thread Sam Mason
On Tue, Nov 18, 2008 at 07:32:33PM +0100, Pavel Stehule wrote: > 2008/11/18 Sam Mason <[EMAIL PROTECTED]>: > > this is what I think you want to do in the context of aggregates: > > > > CREATE FUNCTION array_concat_(ANYARRAY,ANYARRAY) RETURNS ANYARRAY > >A

Re: [HACKERS] [GENERAL] literal limits in 8.3

2008-11-24 Thread Sam Mason
On Mon, Nov 24, 2008 at 02:46:45PM -0500, Tom Lane wrote: > What it boils down to is lack of error checking in psql (not the > backend). Specifically, we fail to enlarge the output buffer for > psqlscan.l, which causes appendBinaryPQExpBuffer to silently not insert > the chunk it's currently being

Re: [HACKERS] Proposal for better PQExpBuffer out-of-memory behavior

2008-11-26 Thread Sam Mason
On Tue, Nov 25, 2008 at 10:33:05AM -0500, Tom Lane wrote: > I've been chewing on the problem described here: > http://archives.postgresql.org/pgsql-general/2008-11/msg01220.php > > It's not particularly easy to fix without making annoyingly large > changes to the API for PQExpBuffer. Yup, I've ju

Re: [HACKERS] WIP: default values for function parameters

2008-12-12 Thread Sam Mason
On Fri, Dec 12, 2008 at 09:00:52AM -0500, Rod Taylor wrote: > How about IS or INTO? > > param_name IS 3 > param_name IS 'some string value' that wouldn't work with NULL would it? for example is: a IS NULL checking if identifier 'a' IS NULL, or if you're giving NULL to parameter 'a'. > 3 INT

Re: [HACKERS] float8 strtod weirdness

2009-01-07 Thread Sam Mason
On Wed, Jan 07, 2009 at 09:56:48AM -0500, Tom Lane wrote: > "Nikhil Sontakke" writes: > > Consider the following with latest CVS sources: > > > postgres=# create table temp(val float4); > > CREATE TABLE > > postgres=# insert into temp values (415.1); > > INSERT 0 1 > > postgres=# select * from te

Re: FWD: Re: [HACKERS] Updated backslash consistency patch

2009-01-15 Thread Sam Mason
On Fri, Jan 16, 2009 at 03:59:47AM +1100, Brendan Jurd wrote: > Most people wanting to learn about which system functions are > available will be surely be going to the manual, not using \df? Presently the only way you'll get a list of functions that operate on large objects is to use \df. They m

Re: FWD: Re: [HACKERS] Updated backslash consistency patch

2009-01-15 Thread Sam Mason
On Thu, Jan 15, 2009 at 09:49:59AM -0800, Joshua D. Drake wrote: > \df output wraps at 1024x768 which greatly limits usability as a whole. > I hadn't noticed this until today as my workstation video card exploded > and I have a temporary one that can't do more than 1024x768 with linux. > Dropping t

Re: [HACKERS] deductive databases in postgreSQL

2009-01-23 Thread Sam Mason
On Fri, Jan 23, 2009 at 10:10:55AM +0100, Carlos Gonzalez-Cadenas wrote: > Yes it's an option, but you cannot rely on the typical consulting company to > do that. Do you know any specialized consulting boutique or individual > developer that could do that? Sending an email to pgsql-j...@postgresql

Re: [HACKERS] 8.5 release timetable, again

2009-08-27 Thread Sam Mason
On Thu, Aug 27, 2009 at 11:29:42AM -0400, Tom Lane wrote: > Robert Haas writes: > > Well, I wasn't suggesting adding a lot more testing of things that > > we're already testing. I was assuming that we would craft the > > additional tests to hit areas that we are not now covering well. My > > poi

Re: [HACKERS] RfD: more powerful "any" types

2009-09-09 Thread Sam Mason
On Wed, Sep 09, 2009 at 03:23:52PM -0400, Tom Lane wrote: > Robert Haas writes: > > What we need is a system where base types are represented > > by an OID, but derived types (list and functional types) are built up > > using type constructors that take other types as arguments. > > This is SQL,

Re: [HACKERS] COALESCE and NULLIF semantics

2009-09-09 Thread Sam Mason
On Wed, Sep 09, 2009 at 10:25:34AM -0400, Tom Lane wrote: > Now admittedly there's probably not any major technical obstacle to > making a runtime conversion happen --- it's merely delayed invocation of > the destination type's input function. But I find it really ugly from a > theoretical point o

Re: [HACKERS] COALESCE and NULLIF semantics

2009-09-11 Thread Sam Mason
On Fri, Sep 11, 2009 at 12:59:04PM -0400, Tom Lane wrote: > "Kevin Grittner" writes: > > I'm only proposing parse-time changes for conditional > > expressions -- the CASE predicate and its abbreviations. > > No, you are not; you are proposing run-time changes, specifically the > need to coerce un

Re: [HACKERS] COALESCE and NULLIF semantics

2009-09-11 Thread Sam Mason
On Fri, Sep 11, 2009 at 06:24:22PM +0100, Sam Mason wrote: > One thing I've just realized these discussions have pointed out is > that PG isn't doing the correct thing all the time with types. When > is it ever valid to see an "unknown" after type checking? AFAICT, i

Re: [HACKERS] COALESCE and NULLIF semantics

2009-09-11 Thread Sam Mason
On Fri, Sep 11, 2009 at 12:26:45PM -0500, Kevin Grittner wrote: > Tom Lane wrote: > > if that weren't true then we wouldn't be arguing about whether > > COALESCE is wrong. > > Yeah, I am. When you have queries built based on which fields on a > QBE window are filled by a user, it's not hard to

Re: [HACKERS] COALESCE and NULLIF semantics

2009-09-11 Thread Sam Mason
> AND (somedate < COALESCE(NULL, NULL) OR ...) > > Right. The only real way to fix that is to propagate the later > discovery that type 'date' would be preferred back to the inputs of the > COALESCE, which is what Sam Mason has been on about (IIUC). Yup; sounds right. The

Re: [HACKERS] COALESCE and NULLIF semantics

2009-09-11 Thread Sam Mason
On Fri, Sep 11, 2009 at 12:41:21PM -0500, Kevin Grittner wrote: > Sam Mason wrote: > > > what you you want is full type-inference as it's only that which > > will allow you to track back up the layers and assign consistent > > types to arbitrary expressions like the

Re: [HACKERS] [BUGS] BUG #5053: domain constraints still leak

2009-09-15 Thread Sam Mason
On Mon, Sep 14, 2009 at 11:20:59PM -0400, Tom Lane wrote: > There is some moderately interesting reading material in section > 4.17.4 "Domain constraints" of SQL:2008. Not sure where to look for a copy of that, nor any particularly helpful links :( > In particular, it appears to > me that the sta

Re: [HACKERS] [BUGS] BUG #5053: domain constraints still leak

2009-09-15 Thread Sam Mason
On Tue, Sep 15, 2009 at 05:13:21AM +0100, Andrew Gierth wrote: > But there's a kicker: in Subclause 6.12, , in the > General Rules is: > > a) If the specifies NULL, then the result of CS is > the null value and no further General Rules of this Subclause > are applied. > > Th

Re: [HACKERS] [BUGS] BUG #5053: domain constraints still leak

2009-09-15 Thread Sam Mason
Explicitly ignoring NULL values in CAST expressions seems like a good feature as well. Although it gives me the feeling that domains are more and more like a mis-designed feature. > >>>>> "Sam" == Sam Mason writes: > Sam> The NOT NULL constraint feels wrong as well,

[HACKERS] libpq port number handling

2009-09-24 Thread Sam Mason
On Thu, Sep 24, 2009 at 07:57:55PM +0100, Sam Mason wrote: > > postg...@sussy:/root> createuser -D -p ricky > > I don't think you want to be passing "-p" here; it's saying to use > "ricky" as the port number, which fails (sounds like a bug if it doe

Re: [GENERAL] [HACKERS] libpq port number handling

2009-09-25 Thread Sam Mason
On Fri, Sep 25, 2009 at 09:29:24AM +0300, Peter Eisentraut wrote: > On Thu, 2009-09-24 at 20:36 -0400, Tom Lane wrote: > > BTW, are port numbers still limited to 16 bits in IPv6? > > Port numbers are in TCP, not in IP. I'd checked that it should work with IPv6, but I hadn't realized that it was b

Re: [HACKERS] half OOT, plv8js group created ^^

2009-10-27 Thread Sam Mason
On Tue, Oct 27, 2009 at 08:30:16AM -0400, Andrew Dunstan wrote: > If someone is going to work on a JS engine for PostgreSQL (which I think > is a good idea, actually) I want them to work on one that is likely to > succeed. The project (at the moment) just seems to be a set of pointers to code I

Re: [HACKERS] Specific names for plpgsql variable-resolution control options?

2009-11-08 Thread Sam Mason
On Fri, Nov 06, 2009 at 07:09:46PM -0800, David E. Wheeler wrote: > On Nov 6, 2009, at 6:57 PM, Tom Lane wrote: > >If we do that, presumably the per-function syntax would be > > #variable_conflict variable_first > >and so on, which is clear enough but might be thought a bit verbose > >for somet

Re: [HACKERS] more support for various frame types of window functions

2009-11-09 Thread Sam Mason
On Mon, Nov 09, 2009 at 10:01:53AM -0500, Tom Lane wrote: > Heikki Linnakangas writes: > > One idea is to take a copy of the state datum after each row. Then, > > instead of initializing the aggregate from scratch, you can "roll back" > > to an earlier copied state. It doesn't always help, but mig

Re: [HACKERS] Common Sub-expression removal

2008-02-19 Thread Sam Mason
Hi, One thing that occurred to me when reading the "Ad Hoc Indexes" thread was that PG doesn't seem to do much with tidying up common sub-expressions (I'm not sure why I remembered about it as it's not particularly related, strange). Anyway, as an example imagine I have a large table that I want

Re: [HACKERS] UUID data format 4x-4x-4x-4x-4x-4x-4x-4x

2008-02-28 Thread Sam Mason
On Thu, Feb 28, 2008 at 06:45:18PM -0500, Mark Mielke wrote: > My personal opinion is that this is entirely a philosophical issue, and > that both sides have merits. I think it depends on what you're optimising for: initial development time, maintaince time or run time. > There is no reason for

Re: [HACKERS] creating new aggregate function

2008-02-29 Thread Sam Mason
On Fri, Feb 29, 2008 at 12:11:59PM -0500, Justin wrote: > Need help and direction creating new aggregate functions. > > We need to add more average functions for both scientific and finical > purposes [ ... ] > what would be the best way to create these new functions?? I'd be tempted to look

Re: [PATCHES] [HACKERS] Text <-> C string

2008-03-19 Thread Sam Mason
On Wed, Mar 19, 2008 at 12:51:35PM -0400, Tom Lane wrote: > "Brendan Jurd" <[EMAIL PROTECTED]> writes: > > char * text_cstring(const text *t) > > What do people think of text_to_cstring? I tend to put things the other way around in my code, i.e: char * cstring_of_text(const text *t) mainly be

[HACKERS] writing a MIN(RECORD) aggregate

2008-03-20 Thread Sam Mason
Hi, I'm trying to write a version of the MIN aggregate for values of RECORD type. I'm somewhat stuck on getting type information about the argument out, I can determine how many attributes it's got but I can't seem to do any better than that. Does anyone have any good pointers into the code for

Re: [HACKERS] Sort Refinement

2008-03-20 Thread Sam Mason
On Thu, Mar 20, 2008 at 05:17:22PM +, Simon Riggs wrote: > Currently, our sort algorithm assumes that its input is unsorted. So if > your data is sorted on (a) and you would like it to be sorted on (a,b) > then we need to perform the full sort of (a,b). > > For small sorts this doesn't matter

Re: [HACKERS] writing a MIN(RECORD) aggregate

2008-03-25 Thread Sam Mason
On Mon, Mar 24, 2008 at 05:27:04PM -0500, Decibel! wrote: > On Mar 20, 2008, at 2:23 PM, Sam Mason wrote: > > SELECT i, (MIN((j,k))).k > > FROM tbl > > GROUP BY i; > > How is that any better than SELECT i, min(k) FROM tbl GROUP BY i ? Because I want the value of k

Re: [HACKERS] writing a MIN(RECORD) aggregate

2008-03-25 Thread Sam Mason
On Mar 25, 2008, at 4:43PM, Gregory Stark wrote: > On Mar 20, 2008, at 2:23 PM, Sam Mason wrote: > > SELECT i, (MIN((j,k))).k > > FROM tbl > > GROUP BY i; > > I have nothing against having min(record) and it does seem like it would let > you do this at least for

Re: [HACKERS] writing a MIN(RECORD) aggregate

2008-03-25 Thread Sam Mason
On Tue, Mar 25, 2008 at 06:58:06PM +, Gregory Stark wrote: > "Sam Mason" <[EMAIL PROTECTED]> writes: > > SELECT i, MIN(k) OVER (PARTITION BY j) > > FROM tbl > > GROUP BY i; > > > > This is obviously wrong, but I don't see how to get

Re: [HACKERS] writing a MIN(RECORD) aggregate

2008-03-25 Thread Sam Mason
On Tue, Mar 25, 2008 at 07:54:17PM +, Gregory Stark wrote: > "Sam Mason" <[EMAIL PROTECTED]> writes: > > SELECT i, (MIN((j,k))).k AS ka, (MIN((mycode(j),k))).k AS kb > > FROM tbl > > GROUP BY i; > > The flip side is that if you want to get seve

Re: [HACKERS] writing a MIN(RECORD) aggregate

2008-03-25 Thread Sam Mason
On Wed, Mar 26, 2008 at 01:03:18AM +, Gregory Stark wrote: > "Sam Mason" <[EMAIL PROTECTED]> writes: > > The reason for the sub-select is only because SQL doesn't provide any > > other way to name expressions. Hum, or at least this should work... > >

Re: [HACKERS] [GENERAL] SHA1 on postgres 8.3

2008-04-03 Thread Sam Mason
On Thu, Apr 03, 2008 at 06:14:17PM +0200, Svenne Krap wrote: > Hashes are an absolute minimum for keeping passwords stored somehat > safely in a database. > More two or even three different hashes with different collion-points > will strongly increase the security. Not only that, but they also

Re: [HACKERS] [GENERAL] SHA1 on postgres 8.3

2008-04-03 Thread Sam Mason
On Thu, Apr 03, 2008 at 07:07:56PM +0200, Svenne Krap wrote: > I currently save only md5(id || username || 'password')* into password, > if I had access to sha1 (for example) i would add another password > column so, having for example > > ID serial > Username varchar > Password_md5 varchar > P

Re: [HACKERS] [GENERAL] SHA1 on postgres 8.3

2008-04-03 Thread Sam Mason
On Fri, Apr 04, 2008 at 12:06:03AM +0200, Svenne Krap wrote: > Sam Mason wrote: > >Are you a cryptanalyst and are you sure that this doesn't actually make > >things worse? I'm sure it gives you a warm fuzzy feeling that it's > >*got* to be better, but unless

Re: [HACKERS] [GENERAL] SHA1 on postgres 8.3

2008-04-03 Thread Sam Mason
On Thu, Apr 03, 2008 at 04:42:47PM -0700, Ron Mayer wrote: > Sam Mason wrote: > >On Thu, Apr 03, 2008 at 07:07:56PM +0200, Svenne Krap wrote: > >> > >>ID serial > >>Username varchar > >>Password_md5 varchar > >>Password_sha1 varchar > >

Re: [HACKERS] COPY Transform support

2008-04-03 Thread Sam Mason
On Thu, Apr 03, 2008 at 03:57:38PM -0400, Tom Lane wrote: > Gregory Stark <[EMAIL PROTECTED]> writes: > > AFAIK the state of the art is actually to load the data into a table which > > closely matches the source material, sometimes just columns of text. Then > > copy > > it all to another table do

Re: [HACKERS] COPY Transform support

2008-04-04 Thread Sam Mason
On Thu, Apr 03, 2008 at 09:38:42PM -0400, Tom Lane wrote: > Sam Mason <[EMAIL PROTECTED]> writes: > > On Thu, Apr 03, 2008 at 03:57:38PM -0400, Tom Lane wrote: > >> I liked the idea of allowing COPY FROM to act as a table source in a > >> larger SELECT or INSER

Re: [HACKERS] Protection from SQL injection

2008-04-28 Thread Sam Mason
On Mon, Apr 28, 2008 at 08:55:34PM +0200, Thomas Mueller wrote: > As you know, "SQL injection" is the main security problem of databases today. > > I think I found a solution: 'disabling literals'. I personally think this is wrong, I often have schemas that mean I have to do things like: SELEC

Re: [HACKERS] Internal design of MERGE, with Rules

2008-04-30 Thread Sam Mason
On Wed, Apr 30, 2008 at 04:58:52PM +0100, Simon Riggs wrote: > That means we probably need to introduce new infrastructure in the tcop > or executor modules to handle queries-within-queries. This isn't > special-casing MERGE so much as introducing infrastructure for a new > class of query, such as

Re: [HACKERS] triggers on prepare, commit, rollback... ?

2008-05-20 Thread Sam Mason
On Tue, May 20, 2008 at 06:38:17AM +0100, James Mansion wrote: > Tom Lane wrote: > >Another response I've heard is "but I don't want to make > >inside-the-database changes, I want to propagate the state to someplace > >external". Of course that's completely broken too, because there is > > Some >

Re: [HACKERS] triggers on prepare, commit, rollback... ?

2008-05-20 Thread Sam Mason
On Tue, May 20, 2008 at 01:20:48PM -0400, Greg Smith wrote: > On Tue, 20 May 2008, Hannu Krosing wrote: > > >Tell others that this trx failed, maybe log a failure ? OTOH, this can > >be implemented by a daemon that sits on "tail -f logfile | grep > >ROLLBACK" > > In order to follow the log file

Re: [HACKERS] [PERFORM] Memory question on win32 systems

2008-05-29 Thread Sam Mason
On Thu, May 29, 2008 at 01:05:22AM +0200, Sabbiolina wrote: > I have 4 Gigs of RAM, how do I force Postgres to use a higher part of such > memory in order to cache more indexes, queries and so on? PG relies on the operating system to cache most disk accesses. Looking at the amount of memory a pro

Re: [HACKERS] 8.4 release planning

2009-01-27 Thread Sam Mason
On Tue, Jan 27, 2009 at 06:20:41AM -0800, Ron Mayer wrote: > For what it's worth, we can see that there are indeed > Postgres forks on the Common Criteria certified list. > > http://www.commoncriteriaportal.org/products_DB.html > PostgreSQL Certified Version V8.1.5 for Linux > Manufacture

Re: [HACKERS] using composite types in insert/update

2009-01-30 Thread Sam Mason
On Wed, Jan 28, 2009 at 12:03:56PM -0500, Merlin Moncure wrote: > IMO, composite types on insert/update should work as they do on select: > INSERT INTO foo VALUES '(something)'::foo -- fails, The VALUES command is just a convenient way of getting lots of tuples into PG isn't it? If the above was

Re: [HACKERS] using composite types in insert/update

2009-01-30 Thread Sam Mason
On Fri, Jan 30, 2009 at 11:01:53AM -0500, Merlin Moncure wrote: > On 1/30/09, Sam Mason wrote: > > The VALUES command is just a convenient way of getting lots of tuples > > into PG isn't it? If the above was valid, PG would have to support > > similar syntax elsewher

Re: [HACKERS] using composite types in insert/update

2009-01-30 Thread Sam Mason
On Fri, Jan 30, 2009 at 02:47:49PM -0500, Merlin Moncure wrote: > On 1/30/09, Tom Lane wrote: > > Merlin Moncure writes: > > > You are missing the point, using the composite type allows you to > > > build the insert without knowing the specific layout of the > > > table... > > > > Surely at *s

Re: [HACKERS] using composite types in insert/update

2009-01-30 Thread Sam Mason
On Fri, Jan 30, 2009 at 03:12:27PM -0500, Merlin Moncure wrote: > On 1/30/09, Sam Mason wrote: > > quite often (i.e. a VALUES command with many singletons). This seems > > a bit annoying and appears to be what you were suggesting you wanted > > before (although you kille

Re: [HACKERS] using composite types in insert/update

2009-01-30 Thread Sam Mason
On Fri, Jan 30, 2009 at 03:29:29PM -0500, Andrew Chernow wrote: > Sam Mason wrote: > >On Fri, Jan 30, 2009 at 02:47:49PM -0500, Merlin Moncure wrote: > >>On 1/30/09, Tom Lane wrote: > >>>Merlin Moncure writes: > >>> > You are missing the

Re: [HACKERS] using composite types in insert/update

2009-01-30 Thread Sam Mason
On Fri, Jan 30, 2009 at 03:45:54PM -0500, Merlin Moncure wrote: > On 1/30/09, Sam Mason wrote: > > I was talking about your example code: > > > > INSERT INTO foo VALUES '(something)'::foo; > > > > This isn't currently valid, but it sounds as

Re: [HACKERS] WIP: hooking parser

2009-02-16 Thread Sam Mason
On Mon, Feb 16, 2009 at 02:35:54PM +0100, Pavel Stehule wrote: > attachment contains module that transform every empty string to null. Why would anyone ever want to do this? This would appear to break all sorts of things in very non-obvious ways: SELECT CASE s WHEN '' THEN 'empty string' ELSE

Re: [HACKERS] WIP: hooking parser

2009-02-16 Thread Sam Mason
On Mon, Feb 16, 2009 at 03:21:12PM +0100, Pavel Stehule wrote: > 2009/2/16 Sam Mason : > > On Mon, Feb 16, 2009 at 02:35:54PM +0100, Pavel Stehule wrote: > >> attachment contains module that transform every empty string to null. > > > > Why would anyone ever want to

Re: [HACKERS] WIP: hooking parser

2009-02-16 Thread Sam Mason
On Mon, Feb 16, 2009 at 04:40:23PM +0100, Pavel Stehule wrote: > 2009/2/16 Sam Mason : > > On Mon, Feb 16, 2009 at 03:21:12PM +0100, Pavel Stehule wrote: > >> so these modules (decode, oraemptystr) decrease differences between > >> PostgreSQL and Oracle. > > &g

Re: [HACKERS] WIP: hooking parser

2009-02-16 Thread Sam Mason
On Mon, Feb 16, 2009 at 08:03:42PM +0100, Pavel Stehule wrote: > 2009/2/16 Sam Mason : > > But to do it properly inside PG would be difficult; how would your hooks > > know to transform: > > > > SELECT s FROM foo WHERE s IS NULL; > > > > into: > > >

Re: [HACKERS] Questions about parsing boolean and casting to anyelement

2009-02-17 Thread Sam Mason
On Mon, Feb 16, 2009 at 08:03:33PM -0500, Tom Lane wrote: > ITAGAKI Takahiro writes: > > I hope anyelement could be used in cast because casts are supported by > > almost programming languages where template or generics are available. Programming languages with "generics" (aka, parametric polymor

Re: [HACKERS] The science of optimization in practical terms?

2009-02-18 Thread Sam Mason
On Wed, Feb 18, 2009 at 01:34:25AM -0500, Tom Lane wrote: > Robert Haas writes: > > I'm interested to know whether anyone else shares my belief that > > nested loops are the cause of most really bad plans. What usually > > happens to me is that the planner develops some unwarranted optimism > > a

Re: [HACKERS] Multi calendar system for pgsql

2009-02-18 Thread Sam Mason
On Wed, Feb 18, 2009 at 07:50:31PM +0330, Mohsen Alimomeni wrote: > Multi calendar systems are useful for several languages and countries using > different calendar: Hijri, Persian, Hebrew, etc. When would the differences between these calenders actually show up? I can only think of it affecting

Re: [HACKERS] WIP: hooking parser

2009-02-19 Thread Sam Mason
On Wed, Feb 18, 2009 at 10:30:12AM -0500, Tom Lane wrote: > Peter Eisentraut writes: > > I'd be quite interested to support some kind of hook to deal with this > > Oracle null issue. It would be a great help for porting projects. > > > However, doing this properly is probably more complex and n

Re: [HACKERS] WIP: hooking parser

2009-02-19 Thread Sam Mason
On Thu, Feb 19, 2009 at 02:02:06PM -0500, Tom Lane wrote: > Sam Mason writes: > > On Wed, Feb 18, 2009 at 10:30:12AM -0500, Tom Lane wrote: > >> AFAIK, the Oracle behavior is just about entirely unrelated to the > >> parser --- it's a matter of runtime comparison

[HACKERS] improving concurrent transactin commit rate

2009-03-24 Thread Sam Mason
Hi, I had an idea while going home last night and still can't think why it's not implemented already as it seems obvious. The conceptual idea is to have at most one outstanding flush for the log going through the filesystem at any one time. The effect, as far as I can think through, would be to

Re: [HACKERS] improving concurrent transactin commit rate

2009-03-25 Thread Sam Mason
[ I'm arbitrarily replying to Greg as his was the most verbose ] On Tue, Mar 24, 2009 at 11:23:36PM -0400, Greg Smith wrote: > On Tue, 24 Mar 2009, Sam Mason wrote: > >The conceptual idea is to have at most one outstanding flush for the > >log going through the filesy

Re: [HACKERS] Matching dimensions in arrays

2009-03-25 Thread Sam Mason
On Wed, Mar 25, 2009 at 12:58:46AM -0700, Scara Maccai wrote: > I've altready asked this some months ago, but I've never seen any answers: > > why do multidimensional arrays have to have matching extents for each > dimension? Because the dimensions define the rectangular bounds of the array in n-

Re: [HACKERS] improving concurrent transactin commit rate

2009-03-25 Thread Sam Mason
On Wed, Mar 25, 2009 at 02:38:45PM +, Greg Stark wrote: > Sam Mason writes: > > Why does it top out so much though? It goes up nicely to around ten > > clients (I tested with 8 and 12) and then tops out and levels off. The > > log is chugging along at around 2MB/s whic

Re: [HACKERS] improving concurrent transactin commit rate

2009-03-25 Thread Sam Mason
On Wed, Mar 25, 2009 at 12:01:57PM -0500, Kenneth Marshall wrote: > On Wed, Mar 25, 2009 at 03:58:06PM +0000, Sam Mason wrote: > > #!/bin/bash > > nclients=$1 > > ittrs=$2 > > function gensql { > > echo "INSERT INTO bm (c,v) VALUES ('$1&#x

Re: [HACKERS] improving concurrent transactin commit rate

2009-03-27 Thread Sam Mason
On Wed, Mar 25, 2009 at 01:48:03PM -0500, Kenneth Marshall wrote: > On Wed, Mar 25, 2009 at 05:56:02PM +0000, Sam Mason wrote: > > On Wed, Mar 25, 2009 at 12:01:57PM -0500, Kenneth Marshall wrote: > > > Are you sure that you are able to actually drive the load at the > >

Re: [HACKERS] [GENERAL] string_to_array with empty input

2009-03-31 Thread Sam Mason
On Tue, Mar 31, 2009 at 05:45:33PM +1100, Brendan Jurd wrote: > On Tue, Mar 31, 2009 at 2:26 PM, Tom Lane wrote: > > Does anyone want to argue for keeping it the same?  Or perhaps > > argue that a zero-element array is a more sensible result than > > a one-element array with one empty string?  (It

Re: [HACKERS] [GENERAL] string_to_array with empty input

2009-03-31 Thread Sam Mason
On Tue, Mar 31, 2009 at 03:43:37PM +0100, Greg Stark wrote: > On Tue, Mar 31, 2009 at 7:45 AM, Brendan Jurd wrote: > > My first thought was that it should be a zero-element array, because > > then the string_to_array() behaviour would conform to the notion that > > it returns an array with 1 eleme

Re: [HACKERS] [GENERAL] string_to_array with empty input

2009-04-01 Thread Sam Mason
[ oops, forgot to send this to -hackers before ] On Tue, Mar 31, 2009 at 05:08:45PM +0100, Greg Stark wrote: > Both interpretations are clearly consistent but it depends on whether > you think it's a bunch of text strings concatenated together or if > it's a list of objects. > > The example of s

  1   2   >