Re: [GENERAL] where to divide application and database

2009-02-20 Thread Sam Mason
On Fri, Feb 20, 2009 at 06:50:22AM -0800, David Fetter wrote: > On Thu, Feb 19, 2009 at 11:43:19PM +0000, Sam Mason wrote: > > On Tue, Feb 17, 2009 at 09:53:00AM -0800, David Fetter wrote: > > > user_name TEXT, -- unless length is an integrity constraint, use TEXT > &

Re: [GENERAL] where to divide application and database

2009-02-20 Thread Sam Mason
security net to maintain. It does, but constraints like that aren't going to be changing to regularly are they? -- Sam http://samason.me.uk/ -- 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] Poor select count(*) performance

2009-02-23 Thread Sam Mason
o go quicker you could try CLUSTERing the table on this index, but then this will slow down other queries that want data to come off the disk in a specific order. It's a balancing act! -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To

Re: [GENERAL] Poor select count(*) performance

2009-02-24 Thread Sam Mason
On Mon, Feb 23, 2009 at 11:21:16PM -0800, Mike Ivanov wrote: > On Mon, Feb 23, 2009 at 6:54 PM, Sam Mason wrote: > > Depending on where these are on disk and how fast your disks are this > > could take up to 30 seconds. > > This does not sound very inspiring :-) It

Re: [GENERAL] Valid characters for user/role/group names?

2009-02-25 Thread Sam Mason
s less portable. ... " You'd want to put double quotes around the identifier. Try searching for "quoted identifier" in the above page. -- Sam http://samason.me.uk/ -- 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] Can I use a query with UPDATE on its SET?

2009-02-26 Thread Sam Mason
how to explain my position and have since forgotten about it. I'll try and think what I was trying to say and respond again. -- Sam http://samason.me.uk/ [1] http://archives.postgresql.org/pgsql-hackers/2009-01/msg02336.php -- Sent via pgsql-general mailing list (pgsql-genera

Re: [GENERAL] Format string for ISO-8601 date and time

2009-02-26 Thread Sam Mason
same timezone. That said, it's a useful set of abstractions as lots of people use them regularly. I'd recommend a read through the docs at: http://www.postgresql.org/docs/current/static/datatype-datetime.html -- Sam http://samason.me.uk/ -- Sent via pgsql-gener

Re: [GENERAL] plpgsql: UPDATE...Returning in FOR loop

2009-03-02 Thread Sam Mason
. Easiest fix would appear to be to use the base type instead of the domain type (I think that would work anyway) or to initialize the variable to something other than NULL. The real fix goes a bit deeper into PG's knowledge of types and SQL's mixing up of Option types. -- Sam http:

Re: [GENERAL] Scanning a large binary field

2009-03-16 Thread Sam Mason
tines as VB didn't seem to be very reliable at handling non-ascii characters. The C library interface is documented here: http://www.postgresql.org/docs/current/static/lo-interfaces.html and the SQL level variants are named similarly (sometimes without an underscore in the name) and hav

Re: [GENERAL] Escaping special characters

2009-03-17 Thread Sam Mason
x27;t. You're putting things in the wrong places! The "E" says that the following literal is using C style escaping. I.e. you want to say: E'Smith \\& Jones' Hope that helps! -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@p

Re: [GENERAL] UPDATE of several columns using SELECT statement

2009-03-17 Thread Sam Mason
parsing) and I don't think it ever gets as far as checking that the value coming back from the select is a record of the same structure as is on the left hand side. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] PostgreSQL versus MySQL for GPS Data

2009-03-17 Thread Sam Mason
ws and the remaining 10 to 20 supporting tables having a few hundred rows. I wouldn't expect row counts to be more accurate than a decimal log and table counts to be more accurate than a ratio of two. That's my two cents anyway! -- Sam http://samason.me.uk/ -- Sent via pgsql-general

Re: [GENERAL] UPDATE of several columns using SELECT statement

2009-03-17 Thread Sam Mason
ov.limit_name AND lb.breach_end IS NULL AND lb.max_breach <= ov.max_breach; I've obviously not tested it, but I think it's correct. It's also got the advantage of much less duplication of code. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing l

Re: [GENERAL] Accent insensitive search?

2009-03-18 Thread Sam Mason
my best suggestion. Performance should be better than using regular expressions. -- Sam http://samason.me.uk/ [1] http://www.postgresql.org/docs/current/static/functions-string.html - Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: h

Re: [GENERAL] How to configure PostgreSQl for low-profile users

2009-03-18 Thread Sam Mason
> cannot read (the text of) the stored procedures, but execute only I believe this can be tied down, yes. > cannot know the 'existence' of the other databases I think this is a little trickier to arrange, why would it matter? -- Sam http://samason.me.uk/ - Sent via pgsql

Re: [GENERAL] Multiple natural joins

2009-03-19 Thread Sam Mason
inappropriately named column to a table. The reason I don't use NATURAL joins is because of these non-local side effects (i.e. changing a table can cause seemingly unrelated queries to suddenly stop working). It's a similar reason why GOTOs and global variables are frowned upon--it&#x

Re: [GENERAL] Defer a functional index calculation?

2009-03-23 Thread Sam Mason
having some trigger to "cache" the entry's root "parent_id" in another column? -- Sam http://samason.me.uk/ [1] http://www.postgresql.org/docs/current/static/sql-createindex.html -- 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] text column constraint, newbie question

2009-03-23 Thread Sam Mason
r doing things differently, it's just that those should be special cases (i.e. performance hacks) and not the norm. Admittedly, using something like PGexecParams is a more awkward; but there are efforts to get decent string interpolation libraries going that "just work". For ex

Re: [GENERAL] MAX(ROW(...)) - feature request

2009-03-25 Thread Sam Mason
rather too tersely in my opinion) that it would be nice if these were supported as well. E.g. CREATE TABLE foo ( i INT ); SELECT least('(1)'::foo,NULL); results in an error. When this should be valid. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgs

Re: [GENERAL] Question about hosting and server grade

2009-03-26 Thread Sam Mason
#x27;s going on in your system when they're happening. -- Sam http://samason.me.uk/ -- 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] log shipping from 64 bit linux server to a 32 bit linux server

2009-03-26 Thread Sam Mason
he doc is quite correct. > > So what is the best way to accomplish a failover from a 64 bit machine to a > 32 bit machine? What about running a 32bit build of PG on the 64bit machine? -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postg

Re: [GENERAL] HINT: Please REINDEX it?

2009-03-26 Thread Sam Mason
seem to be any index related changes since then so maybe your hardware isn't doing what it's told to! > And how do I reindex it? Just type: REINDEX connect_idx; in psql. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgres

Re: [GENERAL] log shipping from 64 bit linux server to a 32 bit linux server

2009-03-27 Thread Sam Mason
l the appropriate libraries as well which may be a bit of a fiddle---especially to keep up to date. Then again, if you're building it yourself you'd need all the libraries anyway so you may as well figure out how to get 32bit packages installed in your 64bit system anyway. -- Sam http://s

Re: [GENERAL] Postgresql On Windows

2009-03-27 Thread Sam Mason
terpret the path and attribute special meaning to backslashes then they will indeed break, but very few programs seem to do this. -- Sam http://samason.me.uk/ -- 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] [GENEAL] dynamically changing table

2009-03-30 Thread Sam Mason
esn't sound like a good choice to be making in the long run. If you don't know what's going on; try leaving the data you're unsure about in a spreadsheet until you understand it better. It's much easier that way than rewriting user interfaces every day because somebo

Re: [GENERAL] [GENEAL] dynamically changing table

2009-03-30 Thread Sam Mason
said data back; it doesn't seem to matter if it actually gets lost! Sounds as though the main unanswered constraint on the database at the moment is what people what to do with the data once they've handed it to you. When you've figured that out you may have a better id

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

2009-03-31 Thread Sam Mason
add a pair of functions like: CREATE FUNCTION array_filter_blanks(TEXT[]) RETURNS TEXT[] LANGUAGE SQL IMMUTABLE STRICT AS $$ ARRAY(SELECT s FROM unnest($1) AS s WHERE s <> '') $$; CREATE FUNCTION array_nullif(ANYARRAY,ANYELEMENT) RETURNS ANYARRAY LANGUAGE SQL IMMUTA

Re: [GENERAL] string_to_array with empty input

2009-03-31 Thread Sam Mason
xpect 3,2,1 and 1. That's also a disingenuous example; what would you expect back from: select count_elements(string_to_array('butter,,milk',',')) I think the semantics you want is what you'd get from: array_filter_blanks(string_to_array($1,$2)) wher

Re: [GENERAL] string_to_array with empty input

2009-04-01 Thread Sam Mason
a,b' array_to_string('{a,NULL,b}'::TEXT[],',') => 'a,b' string_to_array('',',') => '{}' string_to_array(' ',',')=> '{" "}' string_to_array(',',',')=&

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

2009-04-01 Thread Sam Mason
case because it allows: string_to_array(array_to_string(col,','),',') to do the right thing whether it's got zero or more elements in. With the current implementation you get a NULL back in the case of zero elements and the expected array back the rest of the time. T

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

2009-04-01 Thread Sam Mason
ser to make a choice is a bad design decision---the user doesn't need to put a coalesce in and hence their code will probably break in strange ways when they're not expecting it. Nobody suggest adding a third parameter to string_to_array, please! The general mantra that seems to apply

Re: [GENERAL] Help with C-Function on Postgre

2009-04-02 Thread Sam Mason
tatic/spi.html If it's going to be "outside" PG and connect to the database to do its work you want to use the client libraries: http://www.postgresql.org/docs/current/static/libpq.html Hope that helps! -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list

Re: [GENERAL] reducing IO and memory usage: sending the content of a table to multiple files

2009-04-02 Thread Sam Mason
For large datasets this obviously doesn't work well. CURSORs are you friend here. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

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

2009-04-02 Thread Sam Mason
was "simply illegal" for it to do anything else. There are choices for either and a choice needs to be made or the situation should somehow be made impossible. > I would argue against a change to have string_to_array('',',') throw an > error. I'd agre

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

2009-04-02 Thread Sam Mason
empted to pick one and go with it. It's seems a completely arbitrary choice one way or the other but the current behaviour is certainly wrong. I'd go with returning a zero element array because it would do the "right thing" more often when paired with array_to_string. I've also b

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

2009-04-02 Thread Sam Mason
On Thu, Apr 02, 2009 at 12:06:01PM -0700, David E. Wheeler wrote: > On Apr 2, 2009, at 11:24 AM, Sam Mason wrote: > >Yes, I'd be tempted to pick one and go with it. It's seems a > >completely arbitrary choice one way or the other but the current > >behaviour is cert

Re: [GENERAL] reducing IO and memory usage: sending the content of a table to multiple files

2009-04-02 Thread Sam Mason
... Not sure about PG, but the C api pretty much always buffers everything in memory first. There was mention of getting control of this, but I've got no idea where it got. -- Sam http://samason.me.uk/ -- 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] reducing IO and memory usage: sending the content of a table to multiple files

2009-04-03 Thread Sam Mason
On Fri, Apr 03, 2009 at 11:09:56AM +0200, Ivan Sergio Borgonovo wrote: > On Fri, 3 Apr 2009 02:05:19 +0100 Sam Mason wrote: > > On Thu, Apr 02, 2009 at 09:48:33PM +0200, Ivan Sergio Borgonovo wrote: > > > I didn't find any elegant example of cursor use in PHP... OK PH

Re: [GENERAL] slow select in big table

2009-04-03 Thread Sam Mason
hen you won't have a problem. If you want to optimise this case you could also look at CLUSTERing this table on the keyword. -- Sam http://samason.me.uk/ -- 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] PGS Tuning Wizard destroys my login

2009-04-08 Thread Sam Mason
y aren't you looking at the postmaster's log? Not sure where this lives under Windows, but it should tell you why the server is closing the connection. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to y

Re: [GENERAL] Are there performance advantages in storing bulky field in separate table?

2009-04-08 Thread Sam Mason
Craig Ringer3381.4% Ivan Sergio Borgonovo 314 1.3% Sam Mason 3101.3% Raymond O'Donnell 2701.1% Martijn van Oosterhout 2641.1% Greg Smith 2521.0% The remaining ~2000 distinct addresses were less than one percent each. I di

Re: [GENERAL] Are there performance advantages in storing bulky field in separate table?

2009-04-08 Thread Sam Mason
E or Nothing respectively and non-NULL values as (SOME v) or (Just v). -- Sam http://samason.me.uk/ [1] http://www.standardml.org/Basis/option.html [2] http://www.haskell.org/onlinereport/maybe.html -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your s

Re: [GENERAL] Postgres: Starting Server in background mode

2009-04-09 Thread Sam Mason
xecuting the "pg_ctl.exe start", that would be great ! I think you can pass options to CreateProcess that will cause it to "hide" the window; not sure if this is what you want but I've not programmed under Windows for a long time so can't suggest more. -- Sam

Re: [GENERAL] complicated query (newbie..)

2009-04-09 Thread Sam Mason
ific date". If that's correct; you've got a couple of choices, either turn the inner join into an outer join and move it up to join onto the hosts, or get rid of it completely and use the DISTINCT ON clause. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (

Re: [GENERAL] complicated query (newbie..)

2009-04-09 Thread Sam Mason
r.id = m.reservation_id AND m.host_id IS NOT NULL AND (r.start_date,r.end_date) OVERLAPS (${requested_start},${requested_end}) ORDER BY h.id, r.start_date) The formatting is somewhat grim, but I think it should do what you want. -- Sam http://samason.me.uk/ -- Sent via pgsql-gen

Re: [GENERAL] ON condition in LEFT OUTER JOIN doesn't work?!

2009-04-09 Thread Sam Mason
would let this sort of thing through I think, but newer versions will give an error. -- Sam http://samason.me.uk/ -- 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] complicated query (newbie..)

2009-04-09 Thread Sam Mason
ypes. You may need to > add explicit type casts. This is a big hint that things are going wrong. You need those quotes in there, an "integer" is a plain number and not a date. -- Sam http://samason.me.uk/ -- 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] complicated query (newbie..)

2009-04-09 Thread Sam Mason
On Thu, Apr 09, 2009 at 07:25:42PM +0200, Marcin Krol wrote: > Sam Mason wrote: > >This is a big hint that things are going wrong. You need those quotes > >in there, an "integer" is a plain number and not a date. > > This one does work in the sense of selecting out

Re: [GENERAL] complicated query (newbie..)

2009-04-09 Thread Sam Mason
On Thu, Apr 09, 2009 at 08:16:55PM +0200, Marcin Krol wrote: > Sam Mason wrote: > >On Thu, Apr 09, 2009 at 07:25:42PM +0200, Marcin Krol wrote: > >>SELECT h.id, r.id, r.start_date, r.end_date > >> FROM hosts h > >>LEFT JOIN (reservation_hosts m INN

Re: [GENERAL] Internationalization

2009-04-11 Thread Sam Mason
e the code across to the new version of the table and get rid of the view when you're done. -- Sam http://samason.me.uk/ -- 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] Connect without specifying a database?

2009-04-11 Thread Sam Mason
sql-interfaces/2005-02/msg00031.php ), > but I was curious as to whether that's changed. Basically I need to be > able to dynamically determine what databases exist etc before performing > certain actions in my application. What's wrong with "template1" as in the above

Re: [GENERAL] Connect without specifying a database?

2009-04-11 Thread Sam Mason
as desirable (or feasible)? Anything can be done, it's just getting people enthusiastic enough to do it! -- Sam http://samason.me.uk/ -- 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] Connect without specifying a database?

2009-04-11 Thread Sam Mason
OM pg_catalog.pg_database d JOIN pg_catalog.pg_roles r ON d.datdba = r.oid ORDER BY 1; As others have said; the design of PG is such that it's built to assume you're always connected to exactly one database. I'd guess this is an artifact from a long time ago when PG didn't have multiple databases. -- Sam http://samason.me.uk/ -- 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] Maximum number of columns in a table

2009-04-11 Thread Sam Mason
bits of text, because they're getting TOASTed, should be OK. Also note that NULL values get compressed into a bitmap at the beginning of the tuple and so don't take up much space. Hope that helps! -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-gen

Re: [GENERAL] Maximum number of columns in a table

2009-04-11 Thread Sam Mason
data).col0001, (data).col0101 FROM store; Would "data" get detoasted once per row, or per column referenced? -- Sam http://samason.me.uk/ -- 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] Performance of full outer join in 8.3

2009-04-16 Thread Sam Mason
as though what you're trying to do could also be expressed as: SELECT isin FROM ts_frontend.rec_isins WHERE attachment = 2698120 UNION SELECT isin FROM ts_frontend.attachment_isins WHERE attachment = 2698120; not sure if it's part of something larger so this may not be a use

Re: [GENERAL] select distinct, index not used

2009-04-16 Thread Sam Mason
I've had a look in the TODO, but haven't found anything similar. This is obviously only a win when there are few distinct values from compared to the number of rows. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org

Re: [GENERAL] Looking for advice on database encryption

2009-04-17 Thread Sam Mason
ion of the program? Protecting against this in general is, as far as I know, is impossible. The get out clause is that you're not trying to solve the general case, you've got a specific set of use cases that you need to solve. -- Sam http://samason.me.uk/ -- Sent via pgsql-gene

Re: [GENERAL] Looking for advice on database encryption

2009-04-17 Thread Sam Mason
On Fri, Apr 17, 2009 at 09:52:30AM -0400, Bill Moran wrote: > In response to Sam Mason : > > For example; you say that you don't trust the application, yet the user > > must trust the application as they're entering their secret into it. > > How does the user ascerta

Re: [GENERAL] Looking for advice on database encryption

2009-04-17 Thread Sam Mason
we're implementing the tightest security possible > at every layer. This thread is only one part of the overall > process as it specifically relates to the database layer. Yes, that sounds reasonable and to be expected. Hope that's all somewhat helpful! -- Sam http://samason.me.

Re: [GENERAL] Doubt about join clause

2009-04-20 Thread Sam Mason
nt_id, s.id AS store_id, point(c.x,c.y) <-> point(s.x,s.y) AS distance FROM clients c, stores s) ORDER BY client_id, distance; I'd also expect there to be some GiST magic that can be weaved to get the above to work somewhat efficiently. -- Sam http://samason.me.uk/ -- Sent

Re: [GENERAL] This is my first template

2009-04-21 Thread Sam Mason
. You're asking PG for an invalid date and this is its way of telling you so! -- Sam http://samason.me.uk/ -- 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] deleting function

2009-04-24 Thread Sam Mason
usly have different ways of dealing with the ambiguity, but this has worked well for me so far. -- Sam http://samason.me.uk/ -- 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] deleting function

2009-04-26 Thread Sam Mason
g for column names. It could be argued that it would be nice if you got an error in the case of ambiguity like above, but PG doesn't currently do that. If you'd written your delete command as: DELETE FROM testing WHERE testing.id = id; or better: DELETE FROM testing t WHERE

Re: [GENERAL] Open source and diagramming survey

2009-04-27 Thread Sam Mason
to decide whether this should go in; if it's coming from an academic department they will (or should at least) know how much people dislike these sorts of questions and will only include them if necessary. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-gener

Re: [GENERAL] Query organization question

2009-04-28 Thread Sam Mason
ing to apply the outer WHERE clause. I'd try changing the cost of the function first as it should cause PG to do the "right thing" when you use the function in other queries. -- Sam http://samason.me.uk/ [1] http://www.postgresql.org/docs/current/static/sql-createfunction

Re: [GENERAL] triggers and execute...

2009-04-28 Thread Sam Mason
PREPARE _p(parent) AS INSERT INTO subtable SELECT ($1).*; EXECUTE _p(new); DEALLOCATE _p; however this seems to interact badly with the EXECUTE in plpgsql, not sure how to work around that. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgre

Re: [GENERAL] ERROR: syntax error at or near "IF"... why?

2009-05-01 Thread Sam Mason
GUAGE plpgsql; BEGIN; INSERT INTO ... UPDATE ... UPDATE ... SELECT failif((SELECT credit FROM users WHERE name = 'mary') < 0, 'error, credit can't be less than zero'); COMMIT; In general, you're probably better off writing the whole thing in

Re: [GENERAL] Putting many related fields as an array

2009-05-12 Thread Sam Mason
ce the email to > the list. The normal array constructor should work: SELECT ARRAY[MIN(v),MAX(v),AVG(v),STDEV(v)] FROM (VALUES (1),(3),(4)) x(v); Not sure why this is better than using separate columns though. Maybe a new datatype and a custom aggregate would be easier to work with? --

Re: [GENERAL] Unable to access table named "user"

2009-05-12 Thread Sam Mason
7;re connecting to the correct database then? If you connect with psql and do "\dt" does it show up? -- Sam http://samason.me.uk/ -- 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] Putting many related fields as an array

2009-05-12 Thread Sam Mason
ueries are only touching a few columns then it's going to need a lot more disk bandwidth to get a specific number of rows back from the table. -- Sam http://samason.me.uk/ -- 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] Postgres BackUp and Restore: ERROR: duplicate key violates unique constraint "pg_largeobject_loid_pn_index"

2009-05-12 Thread Sam Mason
ed to drop/delete to completely reinitialize my > database ? There are "large objects"[1] remaining in the system. The way I've removed them in the past was by doing a boring: DELETE FROM pg_largeobject; A TRUNCATE could probably be used here as well. I wouldn't go as far as

Re: [GENERAL] postgresql on windows98

2009-05-14 Thread Sam Mason
t'll get away from the religious argument this seems to have turned into. -- Sam http://samason.me.uk/ -- 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] Question on inserting non-ascii strings

2009-05-14 Thread Sam Mason
the parameter from (Perl) to handle the expansion of escape sequences for you. This will cause the expanded string (i.e. the escapes have been interpreted) to be sent to Postgres and everything should just work. Unfortunately I don't use Perl much, so can't give much in the way of a

Re: [GENERAL] Question on inserting non-ascii strings

2009-05-14 Thread Sam Mason
On Thu, May 14, 2009 at 01:57:04PM -0400, Steven Lembark wrote: > On Thu, 14 May 2009 18:44:57 +0100 Sam Mason wrote: > > You want to be using whatever language you're generating the parameter > > from (Perl) to handle the expansion of escape sequences for you. This > &g

Re: [GENERAL] Question on inserting non-ascii strings

2009-05-14 Thread Sam Mason
can have some more confidence that if you have to get other code to talk to the database it's actually doing what you want it to be doing and it's not just Perl being consistent with itself, as it should be. I know I've saved myself a few times doing similar things like this.

Re: [GENERAL] Excel and pg

2009-05-18 Thread Sam Mason
use aggregates > and grouping on Excel. Grouping and aggregates are spelled "pivot tables" in Excel and they work well for a single level, they don't scale to more than one level though and they require considerably more manual housekeeping than SQL. As always, it's about picking the right tools for the job! -- Sam http://samason.me.uk/ -- 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] referring to calculated column in sub select

2009-05-18 Thread Sam Mason
ying to solve a problem like the example, it would probably be easiest to swap the inner and outer queries around, i.e. something like: SELECT acoltest, MAX(b.t) FROM ( SELECT acol + 100 as acoltest FROM mytab2 GROUP BY 1) a LEFT JOIN mytab b ON a.acoltest = b.anothercol GROUP B

Re: [GENERAL] Need help

2009-05-18 Thread Sam Mason
ages seem to indicate that you do not have either of the first to items and so the only choice remaining would be to use the original data. -- Sam http://samason.me.uk/ -- 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] Need help

2009-05-18 Thread Sam Mason
On Mon, May 18, 2009 at 06:15:28PM +0100, Sam Mason wrote: > You need to get the contents of the database from somewhere; the obvious > choices seem to be an existing copy of the PG database directory, a > backup of the database, or the original data. Your previous messages > seem

Re: [GENERAL] Commit visibility guarantees

2009-05-18 Thread Sam Mason
ings "inside" the database, using NOTIFY or somesuch? Could you define what you mean by real-time, do you mean the strict academic meaning or just that you want "interactive" things happening and it would be annoying if they were delayed by a few tens of milliseconds (as oppos

Re: [GENERAL] Commit visibility guarantees

2009-05-18 Thread Sam Mason
r times out, though the timeout > value 60 or more seconds. Even then it's not useful to class it as real-time; nothing "bad" happens if you don't get a response before timeout the user just gets an error message. Real-time applies when if you don't get a response the

Re: [GENERAL] referring to calculated column in sub select

2009-05-19 Thread Sam Mason
thercol=acoltest) as col2 FROM (SELECT somet, acol+100 AS acoltest FROM mytab2) GROUP BY somet; Hope that helps! -- Sam http://samason.me.uk/ -- 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] INTERVAL data type and libpq - what format?

2009-05-19 Thread Sam Mason
; paramValues[2] = " 123 11"; > r = PQexecPrepared(c, "s1", 3, paramValues, NULL, NULL, 0); You get an error because " 123 11" isn't a valid literal of an (undecorated) INTERVAL type. I think PG may do the right thing if you don't specify the typ

Re: [GENERAL] INTERVAL data type and libpq - what format?

2009-05-19 Thread Sam Mason
where all the fields apart from the seconds are zero. Whether this is useful seems debatable, Richard's suggestion of creating a set of custom types that do the right thing for you seems like the path of least resistance. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing

Re: [GENERAL] Can I pause the pg_dump or pg_restore

2009-05-20 Thread Sam Mason
ecommended to pause the backup for days at a time. -- Sam http://samason.me.uk/ -- 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] Can I pause the pg_dump or pg_restore

2009-05-20 Thread Sam Mason
On Wed, May 20, 2009 at 03:39:39PM +0100, Howard Cole wrote: > Sam Mason wrote: > >Note that when used on the pg_dump process all you're doing is stopping > >it from writing out the backup. The server process will still be > >running and waiting for the backup to finish

Re: [GENERAL] How should I deal with disconnects during insert?

2009-05-20 Thread Sam Mason
matching that buffer id then things are good to go. You could have a foreign key on this from the data (the "test" table above) and the database will check that you're only inserting data into it when you say you are. Transactions will ensure that either everything happens or nothing doe

Re: [GENERAL] question on serial key

2009-05-22 Thread Sam Mason
ng one or the other *exclusively* will add complication. General terms to search for are Natural keys vs. Surrogate keys. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Fetch in select statement

2006-04-14 Thread Sam Thukral
Hello,   Is it possible to fetch from a cursor and join the results with the out parameters from a function?  Is it possible to do this in a prepared statement in ADO using ODBC?   Sam Thukral    

[GENERAL] Dblink question

2004-05-19 Thread Sam Masiello
for what I am trying to do? I am sure others out there have had to do similar tasks before so any advice that can be provided would be greatly appreciated! TIA for your time and reply! --Sam ---(end of broadcast)--- TIP 9: the planner will ignore y

Re: [GENERAL] Dblink question

2004-05-19 Thread Sam Masiello
I ran "make" and "make install" which is what I thought the readme said to do. Did I miss something obvious? --Sam -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 19, 2004 1:19 PM To: Sam Masiello Cc: [EMAIL PROTECTED] Subject:

Re: [GENERAL] Dblink question [SOLVED]

2004-05-19 Thread Sam Masiello
Please disregard this thread going forward. I figured it out and feel all the more stupid for it :) --Sam -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sam Masiello Sent: Wednesday, May 19, 2004 1:29 PM To: Tom Lane Cc: [EMAIL PROTECTED] Subject

Re: [GENERAL] Determining scan types

2001-07-03 Thread Sam Tregar
On Tue, 3 Jul 2001, Philip Molter wrote: > What causes this and how can I fix it? Have you tried a VACUUM ANALYZE? For some reason Postgres isn't able to use its indexes fully unless you VACUUM ANALYZE often. I consider this a bug but I gather the developers are OK with i

Re: [GENERAL] OT: Design Books

2001-08-19 Thread Sam Tregar
0138613370). Also useful is a good book on UML, which I've found is invaluable for database design. For this "The Unified Modeling Language User Guide" (0201571684) is good. -sam ---(end of broadcast)--- TIP 2: you can get off all l

Re: MySQL's (false?) claims... (was: Re: [GENERAL] PL/java?)

2001-08-26 Thread Sam Tregar
that corruption cannot occur. Ho ho. This one is my favorite. -sam ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [GENERAL] Practical Cursors

2001-09-18 Thread Sam Tregar
ossible through a lot of hard work. -sam ---(end of broadcast)--- TIP 3: 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] "group, by", problem, when, combined, with, "insert, into"

1999-08-04 Thread sam smith
er; I get ERROR: Illegal use of aggregates or non-group column in target list Am I doing something wrong or is it not possible to combine insert into and group by. I'm using PostgreSQL 6.5.0 Cheers Sam ___ Get Free Email and Do

[GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Sam Z J
o long, please point me to the relavant text =D thanks -- Zhongshi (Sam) Jiang sammyjiang...@gmail.com

Re: [GENERAL] efficiency of wildcards at both ends

2012-06-20 Thread Sam Z J
thank you all for the useful information =D On Wed, Jun 20, 2012 at 1:39 PM, Alan Hodgson wrote: > On Wednesday, June 20, 2012 01:10:03 PM Sam Z J wrote: > > Hi all > > > > I'm curious how is wildcards at both ends implemented, e.g. LIKE '%str%' > > How

<    3   4   5   6   7   8   9   >