Re: [SQL] organizing cron jobs in one function

2012-11-18 Thread Craig Ringer
On 11/19/2012 01:11 AM, Louis-David Mitterrand wrote: > On Sun, Nov 18, 2012 at 07:27:54PM +0800, Craig Ringer wrote: >> On 11/18/2012 12:19 AM, Louis-David Mitterrand wrote: >>> Hi, >>> >>> I'm planning to centralize all db maintenance jobs from a single &

Re: [SQL] organizing cron jobs in one function

2012-11-18 Thread Craig Ringer
ing PgAgent. Why not use PgAgent instead? -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] find sudstring on text (data type) field failure

2012-11-11 Thread Craig Ringer
On 11/07/2012 04:36 PM, pantelis vlachos wrote: > I was trying to find a substring on a text (data type) column like > 'cat foo dog ...'. > I use the query below > SELECT id FROM table WHERE name LIKE '% foo %'; > Sometimes the query return with nTuples=0 but there are matching rows. > On retry, th

Re: [SQL] Calling the CTE for multiple inputs

2012-10-04 Thread Craig Ringer
uery where required. Without a schema to test with and some understanding of what the query does it's hard to say exactly. Wrapping it in a function is likely to be less efficient, but probably easier. -- Craig Ringer WITH cal AS ( SELECT generate_series('2

Re: [SQL] ORDER BY COLUMN_A, (COLUMN_B or COLUMN_C), COLUMN_D

2012-09-16 Thread Craig Ringer
as an aggregate: regress=# SELECT min(x.a) FROM ( VALUES ('blah'),('blah2'),('') ) x(a); min -- (1 row) -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Tablesample Function on Postgres 9.1

2012-08-29 Thread Craig Ringer
l.org/wiki/TABLESAMPLE_Implementation) Sorry, that wiki page is just blue-sky speculation. If the feature were supported, you would find it in the main documentation. Wiki page updated to make that clearer. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make chang

Re: [SQL] Selecting data from XML

2012-07-16 Thread Craig Ringer
/static/functions-xml.html#FUNCTIONS-XML-PROCESSING You should be able to do it with some xpath expressions. It probably won't be fast or pretty. Consider using PL/Python, PL/perl, PL/Java, or something like that to do the processing and return the resultset. -- Craig Ringer

Re: [SQL] Simple Upgrade from PostgreSQL version 8.1.11 (With schemas)

2012-07-10 Thread Craig Ringer
nd see what breaks. For simpler apps that can be a reasonable choice. -- Craig Ringer

Re: [SQL] How to limit access only to certain records?

2012-06-23 Thread Craig Ringer
w.postgresql.org/docs/9.1/static/sql-createfunction.html> http://www.postgresql.org/docs/current/static/sql-grant.html <http://www.postgresql.org/docs/9.1/static/sql-grant.html> http://www.postgresql.org/docs/current/static/sql-revoke.html <http://www.postgresql.org/docs/9.1/static/sql-revoke.html> Hope this helps. -- Craig Ringer

Re: [SQL] Is there a similarity-function that minds national charsets?

2012-06-20 Thread Craig Ringer
); SELECT similarity( flatten_accent('Müller'), target_column ); Note that the flatten_accent function must be IMMUTABLE and can't access or refer to data in other tables, columns, etc nor SET (GUC) variables that might change at runtime. -- Craig Ringer -- Sent via pgsql-sql mai

Re: [SQL] Insane behaviour in 8.3.3

2012-06-19 Thread Craig Ringer
nt than SW upgrades. ... and a lot more difficult :S Log monitoring is often the most imporant part - monitoring for NMIs and other hardware notifications, checking the kernel log for odd issues or reports of unexpected segfaults from userspace programs, etc. -- Craig Ringer -- Sent via

Re: [SQL] how to use schema with data type

2012-06-12 Thread Craig Ringer
ong, and when? What error messges did you get? The first form looks reasonable to me, though I haven't tested. If you need to quote the schema for caps reasons, you'd use: "xchromasun"."weekly_mpr" -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-s

Re: [SQL] Partitioned Tables

2012-06-12 Thread Craig Ringer
in the parent and report that. As a workaround, ignore the insert count for partitioned tables, or insert directly into the appropriate partition(s). -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] possible bug in psql

2012-05-29 Thread Craig Ringer
l(SIGWINCH) its ppid since it is so often invoked as a helper. I guess they probably have good reasons not to. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] JDBC Statement.setQueryTimeout : is there plan to implement this?

2011-12-14 Thread Craig Ringer
Replied on pgsql-jdbc; please follow the discussion there. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] JDBC Statement.setQueryTimeout : is there plan to implement this?

2011-12-14 Thread Craig Ringer
On 12/14/2011 11:30 PM, Sylvain Mougenot wrote: Thank you Craig Ringer for the detailed list of post (I found some by myself). Specially, I'm glad to see it is #1 "TODO" on the compliance matters. http://jdbc.postgresql.org/todo.html#Compliance As a reminder, I found post (on th

Re: [SQL] JDBC Statement.setQueryTimeout : is there plan to implement this?

2011-12-14 Thread Craig Ringer
an be done in a container-independent way (*shudder*). I'm quite sure that using EJB timers is NOT the right way to do it - they're not supported by web profile containers and are really intended for "business level" timers that should be persistent across redeploy/relaunch of

Re: [SQL] JDBC Statement.setQueryTimeout : is there plan to implement this?

2011-12-14 Thread Craig Ringer
meout+&l=&d=-1&s=d> IIRC there are server backend changes required to make it possible to implement setQueryTimeout, and nobody's come up with an acceptable patch. I haven't followed the issue so I could easily be mistaken, though. -- Craig Ringer -- Sent via pgsql

Re: [SQL] Query Timeout Question

2011-12-08 Thread Craig Ringer
ether the ODBC driver uses that or not. Examine the ODBC `mylog' output after enabling psqlODBC debugging, and examine the server log after turning on query logging, so you can see what the ODBC driver actually asks the server for when you set a query timeout. -- Craig Ringer

Re: [SQL] partitions versus databases

2011-12-08 Thread Craig Ringer
-postgresql-are-partitions-or-multiple-databases-more-efficient/ That'll help avoid duplication of effort, and make it easier for people searching for similar topics later to find out more. -- Craig Ringer

Re: [SQL] No response from the backend

2011-12-07 Thread Craig Ringer
same host, it's unlikely to be network connectivity. Check the server logs. -- Craig Ringer

Re: [SQL] No response from the backend

2011-12-07 Thread Craig Ringer
they connected? etc. -- Craig Ringer

Re: [SQL] pg_dump : problem with grant on table columns

2011-11-15 Thread Craig Ringer
On Nov 15, 2011 9:46 PM, "Brice André" wrote: > > Hello, > > I sometimes define some access rights on table columns instead of whole table. Everything works fine except when I perform a dump. > > When I dump a databse that contains such access rights, the pg_dump utility generates commands like th

Re: [SQL] How to implement Aggregate Awareness?

2011-11-05 Thread Craig Ringer
nhanced to recognise queries against a base table and rewrite it to use a materialized view of the table when it sees that the query only touches data collected by the materialized view. Right now, there isn't really anything for query rewriting like this to /target/ . -- Craig Ringer --

Re: [SQL] How to write sql to access another odbc source.

2011-10-25 Thread Craig Ringer
able to do it even more easily using ODBC FDW (SQL/MED). -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Handling mutliple clients access with views

2011-10-24 Thread Craig Ringer
nce row-level security is implemented you could switch to that without the app caring. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Handling mutliple clients access with views

2011-10-24 Thread Craig Ringer
way of doing what I try to do ? Or maybe am I a > little bit too paranoïde, and maybe should I handle all my clients with > a single postgresql user, handling all safety aspect in my php script ? Nope, I heartily approve of doing security in-database, especially if you can do it declarativel

Re: [SQL] how to temporally disable foreign key constraint check

2011-10-21 Thread Craig Ringer
that enforce the checks on particular tables. This must be done table-by-table, there's no global way to do it. Use ALTER TABLE ... DISABLE TRIGGER to do it. See: http://www.postgresql.org/docs/current/static/sql-altertable.html -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsq

Re: [SQL] FW: Hi

2011-09-11 Thread Craig Ringer
. You want the FIRST error. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] (pgsql8.4) DATA Corruption

2011-08-25 Thread Craig Ringer
. People here will normally advise you to do that first and I'm kind of surprised nobody did. -- Craig Ringer

Re: [SQL] Looking for a "show create table " equivalent

2011-07-14 Thread Craig Ringer
ystem. If the INFORMATION_SCHEMA isn't sufficient for the OP's purposes or is too clumsy for re-creating DDL from, there's another option. It's ugly, but you can add a plpythonu or plperlu server-side function that calls the server's copy of pg_dump and spits the resulting text back

Re: [SQL] best performance for simple dml

2011-06-27 Thread Craig Ringer
O foo VALUES (1,'joe','dean'), (4,'fred','bob'), (11,'anne','smith'); There'll be a threshhold above which the COPY protocol becomes faster, though. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Problems Pgdump

2011-05-24 Thread Craig Ringer
ase folding, see: http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS http://sql-info.de/postgresql/postgres-gotchas.html http://archives.postgresql.org/pgsql-hackers/2004-04/msg00818.php -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Which version of PostgreSQL should I use.

2011-05-24 Thread Craig Ringer
an application's own dump/load feature rather than pg_dump and the app wasn't ready for the new bytea format. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Which version of PostgreSQL should I use.

2011-05-23 Thread Craig Ringer
t doesn't understand the new hex format. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] extracting location info from string

2011-05-23 Thread Craig Ringer
sy to INSERT a record into a side table that flags it for later examination if necessary, and to RAISE NOTICE or to issue a NOTIFY if you need to do closer-to-realtime checking. -- Craig Ringer Tech-related writing at http://soapyfrogs.blogspot.com/ -- Sent via pgsql-sql mailing list (pgs

Re: [SQL] Which version of PostgreSQL should I use.

2011-05-23 Thread Craig Ringer
On 23/05/2011 11:19 PM, jasmin.dizdare...@gmail.com wrote: Just be careful with pg_dump, if you have binary data stored in your 8.4 db. In default mode it just export text. Er ... what? Can you elaborate on that? Do you mean large objects? bytea fields? Something else? -- Craig Ringer

Re: [SQL] extracting location info from string

2011-05-22 Thread Craig Ringer
t to impossible to distinguish it from a country. Not least because some places are both, eg: Luxembourg The Vatican Singapore (The Grand Duchy of Luxembourg has other cities, but still serves as an example). -- Craig Ringer Tech-related writing at http://soapyfrogs.blogspot.com/ -- Se

Re: [SQL] unnest in SELECT

2011-05-21 Thread Craig Ringer
set-returning function, and it doesn't really make that much sense to have them in the SELECT list anyway. Few databases support it, and PostgreSQL's behavior is a historical quirk that I think most people here hope will go quietly away at some point. Use unnest in a FROM clause. -

Re: [SQL] column type for pdf file

2011-05-19 Thread Craig Ringer
, you need another way to talk to the server than just the Pg connection, and most importantly your backups become more complicated because you have two things to back up. It's not simple, and it depends a lot on how much the data changes, how big the files are, etc. -- Craig Ringer --

Re: [SQL] column type for pdf file

2011-05-18 Thread Craig Ringer
ystem integrates into database transactions, so you kind of get the best of both worlds. Very cool. If reiser4 hadn't gone the way of the dodo such a thing might've become possible on Linux, but I'm not aware of any other Linux file systems that safely support transactions. -

Re: [SQL] client-side lo_import() provided by libpq ?

2011-05-18 Thread Craig Ringer
On 05/19/2011 04:51 AM, Emi Lu wrote: About client-side lo_import(), is there an online doc about install lo_import? It's in the manual. http://www.postgresql.org/docs/current/static/lo-examplesect.html -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To

Re: [SQL] Performance of NOT IN and <> with PG 9.0.4

2011-05-16 Thread Craig Ringer
On 05/16/2011 06:05 PM, Jasmin Dizdarevic wrote: Hi, is there a reason why Not IN-performance is so poor in 9.0.4 compared to 8.4? Example queries? EXPLAIN ANALYZE output? http://wiki.postgresql.org/wiki/SlowQueryQuestions -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql

Re: [SQL] PosgreSQL - TSQL2 question

2011-02-06 Thread Craig Ringer
On 06/02/11 06:26, Sarbu Anca wrote: > Could you please tell me what I need to do to run TSQL2 on PostrgreSQL > for Windows? What do I need to install? Where can I found it? How do I > do the installation. The temporal support extension is at : http://temporal.projects.postgresql.org/ and is

Re: [SQL] check files .backup

2011-01-26 Thread Craig Ringer
fix it! __END__ fi Second: after writing the backup, calculate an md5sum or (preferably) digitally sign the backup using gpg. An md5sum is only really protection against corruption unless you store it somewhere separate and secure. I prefer to digitally sign my backups with detached gpg signatu

Re: [SQL] check files .backup

2011-01-24 Thread Craig Ringer
On 25/01/11 08:18, manuel antonio ochoa wrote: > Do you know if exist a function to check my file.backup created by > pgdump. ? What do you want to check? That it restores correctly? That it's complete and not truncated? That it hasn't been modified since being originally written? That it matches

Re: [SQL] find and replace the string within a column

2010-09-24 Thread Craig Ringer
ching \([^)]+\) (in other words "an open parenthisis, then a sequence of one or more of any character other than a close parenthesis, followed by a close parentheis) and replacing with an empty string ? -- Craig Ringer Tech-related writing at http://soapyfrogs.blogspot.com/ -- Sent via pgsql-sql ma

Re: [SQL] HowTo divide streetname from house-nr ?

2010-09-22 Thread Craig Ringer
IMO you're better off using existing tools that do this with free-form addresses using national phone databases, postcode databases, etc. -- Craig Ringer Tech-related writing at http://soapyfrogs.blogspot.com/ -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to

Re: [SQL] Slow response in select

2010-09-21 Thread Craig Ringer
.ringways.co.uk/explain.txt Woah. That's an interesting plan. When concerned about execution time, it's probably best to post EXPLAIN ANALYZE rather than plain EXPLAIN results. EXPLAIN ANALYZE provides more timing information and information about how rowcount estimates differed from r

Re: [SQL] Jagged/ragged arrays

2010-09-20 Thread Craig Ringer
On 21/09/2010 3:42 AM, Dmitriy Igrishin wrote: Hey Florian, What do you mean by "ragged" arrays? At a guess: craig=> SELECT '{ {1}, {1,2}, {1}, {1,2,3} }'::integer[][]; ERROR: multidimensional arrays must have array expressions with matching dimensions (OP) Co

Re: [SQL] Using SKYLINE command on PostgreSQL

2010-08-07 Thread Craig Ringer
8.4devel, but I suspect that since 8.4 has been out for ages and 9.0 is almost released, they've probably lost interest and dropped the work. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL]

2010-05-21 Thread Craig Ringer
this list for MS Access. I eventually ditched Access entirely as the user who was demanding the use of MS Access relented (phew!), so I put together a simple web-app to do what they wanted in a day. Hopefully I'll never need to go near ODBC again, because it's a truly "special

Re: [SQL] kind of RULE on SELECT depending on existence of a WHERE condition

2010-03-02 Thread Craig Ringer
ers(param1, param2) etc. Each one would substitute parameters into existing SQL using `EXECUTE USING'. Possibly-null params can be handled using COALESCE or CASE to avoid string-building. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] indexes

2010-01-17 Thread Craig Ringer
urrent data by eliminating the need for tree-like multiple self joins. Updates to these views are cheap, because the triggers on the source tables can selectively update only the mat.view entries they know are affected by a given update/insert/delete. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] [GENERAL] DataBase Problem

2009-12-29 Thread Craig Ringer
proxool logs and see why the connection was closed. The error message its self gives you the next step. I suggest reading this: http://wiki.postgresql.org/wiki/Guide_to_reporting_problems for some hints in case you need to ask a more detailed follow-up. -- Craig Ringer -- Sent via pgsql-sql mai

Re: [SQL] Foreign key - Indexing & Deadlocking.

2009-12-29 Thread Craig Ringer
x, the referencing table will be sequentially scanned 100 times. Needless to say, you want to add indexes to your foreign keys if you expect to delete from the parent, or (for some reason) update the primary key value for rows in the parent table. -- Craig Ringer -- Sent via pgsql-sql

Re: [SQL] Using || operator to fold multiple columns into one

2009-12-24 Thread Craig Ringer
On 24/12/2009 5:04 AM, Rosser Schwarz wrote: On Wed, Dec 23, 2009 at 1:44 AM, Craig Ringer wrote: SELECT COALESCE( t_number::text, t:string::text, t_date::text, t_boolean::text) AS value; Your invocation of COALESCE is incorrect -- it is n-ary, but it returns its first non-NULL argument

Re: [SQL] short-cutting if sum()>constant

2009-12-23 Thread Craig Ringer
ectly machine-executable code as you suggested, by the way. It'd really require a just-in-time compiler akin to what Java uses, though the ability to compile once and cache would help get rid of some of the complexity of Java's. It'd quickly become attractive to just use PL/Java ins

Re: [SQL] Using || operator to fold multiple columns into one

2009-12-23 Thread Craig Ringer
statement, eg: SELECT COALESCE( t_number::text, t:string::text, t_date::text, t_boolean::text) AS value; Also: You do have a CHECK constraint on the table that asserts that at most one of those entries may be non-null, right? If not, you're very likely to land up with entries with more than o

Re: [SQL] Profiling tool for postgres under win32

2009-11-30 Thread Craig Ringer
al with the latency. Sometimes queries are slow, especially over slow links. Do your work in a background worker thread, and keep the UI responsive. (Doesn't make sense for web apps, but is important for normal GUI apps). - Get faster disks, more RAM for caching, etc. -- Craig Ringer -- S

Re: [SQL] Profiling tool for postgres under win32

2009-11-26 Thread Craig Ringer
ssibly via JPA)? If you're using Hibernate, just enable its query logging features via log4j and watch what happens. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Why don't I get a LATIN1 encoding here with SET ENCODING?

2009-11-03 Thread Craig Ringer
Bryce Nesbitt wrote: > Craig Ringer wrote: >> Yes - but you are *not* presenting a Latin-1 character. You're >> presenting four Latin-1 characters: >> >> '\', '3', '7', '5' > Well, then I have a different question. If

Re: [SQL] Why don't I get a LATIN1 encoding here with SET ENCODING?

2009-11-03 Thread Craig Ringer
Bryce Nesbitt wrote: > Craig Ringer wrote: >> Yes - but you are *not* presenting a Latin-1 character. You're >> presenting four Latin-1 characters: >> >> '\', '3', '7', '5' > Well, then I have a different question. If

Re: [SQL] Why don't I get a LATIN1 encoding here with SET ENCODING?

2009-11-03 Thread Craig Ringer
Bryce Nesbitt wrote: > > > Craig Ringer wrote: >> In truth, that's how I'd expect it to happen. If I ask for the byte 0xfd >> in a string, I don't want the server to decide that I must've meant >> something else because I have a different client

Re: [SQL] Why don't I get a LATIN1 encoding here with SET ENCODING?

2009-11-03 Thread Craig Ringer
processed. In truth, that's how I'd expect it to happen. If I ask for the byte 0xfd in a string, I don't want the server to decide that I must've meant something else because I have a different client encoding. If I wanted encoding conversion, I wouldn't have written it

Re: [SQL] @@Error equivalent in Postgresql

2009-10-23 Thread Craig Ringer
SQL statement, causing the JDBC driver to throw a Java SQLException that in turn propagates up to code that's in a position to do something about the problem. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Random Unique Id

2009-10-20 Thread Craig Ringer
x27;s what I'm using: http://wiki.postgresql.org/wiki/Pseudo_encrypt thanks to the incredibly helpful folks on this list, in this case particularly Daniel Verite. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.post

Re: [SQL] Hibernate, web application and only one sequence for all primary keys

2009-09-17 Thread Craig Ringer
B. The Hibernate documentation is pretty good, and covers this sort of thing well. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Multiple simultaneous queries on single connection

2009-08-18 Thread Craig Ringer
use explicitly declared cursors and FETCH to interleave requests for results from one or more queries in the same transation using the one connection, but only one FETCH may be active at a time. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to

Re: [SQL] Bit by "commands ignored until end of transaction block" again

2009-07-26 Thread Craig Ringer
t; RELEASE SAVEPOINT User } # SQL => 'COMMIT' ... so that inner transactions could ROLLBACK TO SAVEPOINT on error , and so that asking for a rollback would give you a ROLLBACK TO SAVEPOINT if the transaction is a subtransaction. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Bit by "commands ignored until end of transaction block" again

2009-07-24 Thread Craig Ringer
big difference. Most applications with this sort of thing will have app-level transaction APIs that contain and manage the DB-level ones anyway. > RELEASE SAVEPOINT would only COMMIT the transaction *if* the savepoint > that it's releasing started it. So, what you're really asking

Re: [SQL] Bit by "commands ignored until end of transaction block" again

2009-07-24 Thread Craig Ringer
ction. To a PL/PgSQL function there is NO difference between: begin; select my_function(); commit; and a standalone: select my_function(); in both cases the statement executes in a transaction, and in both cases individual statements within the function are within the same transaction. That's why any function can EXCEPTION blocks, etc, which rely on savepoints. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] uniqueness constraint with NULLs

2009-06-29 Thread Craig Ringer
bles, though, you'll still have a mix of expired and unexpired rows in the table heap. The data of interest will be scattered across more blocks, so the index will be bigger and more data will have to be read in to satisfy a `where c is not null' constrained query. So a partial index isn&#

Re: [SQL] uniqueness constraint with NULLs

2009-06-29 Thread Craig Ringer
n the real app., c is a date field and I require it to be NULL for > some rows. Oh. Er, In that case, the partial unique index is your best bet (but 'a' and 'b' should ne NOT NULL, right). > in case I am missing some other solution that > doesn't involve the use o

Re: [SQL] backup and restore

2009-05-08 Thread Craig Ringer
Craig Ringer wrote: ... something kinda rude, in retrospect. Sorry. Unpleasantness is going around in my immediate environment, and I'm apparently prickly and grumpy. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription:

Re: [SQL] backup and restore

2009-05-08 Thread Craig Ringer
ed mail clients will thread your message under a now-unrelated thread. Compose a new message instead." -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

[SQL] select regexp_matches('a a a', '([a-z]) a','g');

2009-05-07 Thread Craig Ringer
leading `a' characters. What you need is a zero-width lookahead assertion, available in Perl-style extended regular expressions. Handily, recent PostgreSQL versions support these, so you can write: test=> select regexp_matches( 'a a a', '([a-z]) (?=a)', 'g'); r

Re: [SQL] using a list to query

2009-05-02 Thread Craig Ringer
kid IN ( SELECT x FROM regexp_split_to_table(myTextfield, ',') AS x ); ... but you should consider storing your list in an array instead, or using a more conventional child table with a (pkid, refid) pair list. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@po

Re: [SQL] Performance problem with row count trigger

2009-04-02 Thread Craig Ringer
your `dataset' table as narrow as possible. If the catalog_id, t_begin, t_end, ctime and mtime fields do not change almost as often as the assoc_count field, split them into a separate table with a foreign key referencing dataset_id, rather than storing them directly in the dataset table. -- C

Re: [SQL] Creating a function with single quotes

2009-02-19 Thread Craig Ringer
as $$ BEGIN RETURN $1 * interval '1 msec' END; $$ LANGUAGE 'plpgsql'; -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] = or LIKE ?

2009-02-15 Thread Craig Ringer
Jesper Krogh wrote: So I cannot rely on the like operator to behave correct if I'd like to compare strings with backslashes (e.g. filepaths from MS Windows filesystems)? test=# SELECT E'\\' LIKE E'\\' ESCAPE ''; ?column? ------ t (1 row) -- Craig Ri

Re: [SQL] dynamic OUT parameters?

2009-01-31 Thread Craig Ringer
: http://www.postgresql.org/docs/8.2/interactive/plpgsql-cursors.html#AEN40465 Personally, I find it difficult to imagine what could be wrong with that. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] dynamic OUT parameters?

2009-01-30 Thread Craig Ringer
, you don't have to do any special work to call the function, and you can (with most DB access APIs) FETCH records from the cursor rather conveniently. See: http://www.postgresql.org/docs/8.3/static/plpgsql-cursors.html -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgre

Re: [SQL] dynamic OUT parameters?

2009-01-30 Thread Craig Ringer
s information to the application, so it can call the first function to get the information required to correctly call your dynamic reporting function. > 2) Can i make a special type "on_the_fly" and returning setof "that_type"? You're better off using SETOF RECORD

Re: [SQL] How much the max image size can be inserted into Postgresql

2008-12-24 Thread Craig Ringer
then the appropriate section of the MANUAL is: http://www.postgresql.org/docs/current/static/largeobjects.html If those assumptions are invalid or insufficient, perhaps you could provide a more complete description of how you're doing things? -- Craig Ringer -- Sent via pgsql-

Re: [SQL] Sequence and nextval problem

2008-11-24 Thread Craig Ringer
Earlier, Craig Ringer wrote: for sample operator/cast definitions. There are some notes in the top of the "passthrough.txt" module I attached that explain the ODBC driver options you'll want. Also, note that in the message I just posted the function DSN() must be adapted

Re: [SQL] Sequence and nextval problem

2008-11-24 Thread Craig Ringer
om/journal/index.php?/archives/24-Using-MS-Access-with-PostgreSQL.html for sample operator/cast definitions. There are some notes in the top of the "passthrough.txt" module I attached that explain the ODBC driver options you'll want. -- Craig Ringer Private Sub Form_BeforeInsert(Can

Re: [SQL] UPDATE and DELEte with a lot of register is to slow...

2008-11-20 Thread Craig Ringer
? Is the problem that the UPDATE or DELETE takes a long time, or that it slows down other queries? -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] [PERFORM] Can we activate WAL runtime?

2008-11-10 Thread Craig Ringer
h. Simon's given no argument at all why it would be safe to flip it on-the-fly." Again, though, that may be new in 8.3, I really would wait for some confirmation. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www

Re: [SQL] EXISTS

2008-10-14 Thread Craig Ringer
dmin/maintenance scripts) but the current approach does work fine. It also helps that you can often achieve the required logic with plain, standard SQL. The CASE statement is particularly useful: SELECT CASE WHEN col1 = 'mystring' THEN [expression or function call] END FROM T

Re: [SQL] Special grouping on sorted data.

2008-09-22 Thread Craig Ringer
like postgresql to send it that way. If the next n is different create a new row. I suspect that Crystal Reports may be pulling the whole data set from PostgreSQL then doing its processing client-side. Try turning on query logging in the server and running your report. See what SQL Crystal Reports

Re: [SQL] Multi-line text fields

2008-09-22 Thread Craig Ringer
any trailing \r in case of DOS line endings. A little C function that copied the input only up to the first newline would instead probably be the fastest. It'd also let you easily strip the trailing \r if any was present. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] pg_restore in java connection (auto_commit = false)

2008-09-10 Thread Craig Ringer
whether there's a better way to achieve what you're trying to do in the first place that doesn't involve all this per-table dump and restore hassle at all. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] more than 1000 connections

2008-08-06 Thread Craig Ringer
ink we're psychic" email template on the wiki soon, as the number of people who don't provide the basic information needed to usefully answer most questions seems to be continually increasing.] > I need configure a pool of connection or something. Yes, I'd say so. What is preven

Re: [SQL] more than 1000 connections

2008-08-05 Thread Craig Ringer
ning into connection count limits, but I shouldn't have to guess that. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Function returning setof taking parameters from another table

2008-08-01 Thread Craig Ringer
t run this one to see what it does. -- SELECT x, gsp(x) FROM generate_series(1,10) as x; -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] PERSISTANT PREPARE (another point of view)

2008-07-21 Thread Craig Ringer
ECUTE or SELECT function(params). It's pretty clear that there are some tricky aspects though, what with schema search paths, role priveleges, etc. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.or

Re: [SQL] PERSISTANT PREPARE (another point of view)

2008-07-21 Thread Craig Ringer
n, I don't know much about Pg's innards, so that doesn't mean much. Tom Lane responded to that post to point out some of the complexities: http://archives.postgresql.org/pgsql-hackers/2008-04/msg00868.php -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@pos

Re: [SQL] How to find space occupied by postgres on harddisk

2008-07-07 Thread Craig Ringer
's what you meant). That'll tell you for sure. It's not like a 5GB dump will take all that long to load. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Update and trigger

2008-06-10 Thread Craig Ringer
an inline procedure for the execute No, at present you must create a function that returns TRIGGER and then use that as the target to execute. At least as far as I know. -- Craig Ringer -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http:

  1   2   >