[SQL] Lead and tail quotes with \pset fieldsep

2006-03-19 Thread Bath, David
Folks If I want psql to generate CSV files fully-double-quoted I can use pset as follows psql> \pset fieldsep "," However this does not put a quote before the first field and after the last, so each row comes out as 1234","blahblah","sdfgsg","foo","bar Is there a way to use psql to give rows like

[SQL] Dump/restore comments only?

2006-02-26 Thread Bath, David
Folks, There have been a number of times when I've wanted to ignore everything in a dump file apart from comments. I am interested not just in comments for tables/views/columns but constraints, indices and functions as well. Many of my comments are multi-line and often resemble manpages, so a si

[SQL] Disabling triggers/constraints pg<8.1

2006-02-26 Thread Bath, David
Folks, Questions about disabling/enabling triggers/constraints "through the back door" in pg versions that do not support DISABLE|ENABLE of such things? Background: pg 8.1 has the ability to DISABLE/ENABLE a particular trigger, and it looks like we'll be getting DISABLE/ENABLE CONSTRAINT stat

Re: [SQL] create table and data types

2006-02-14 Thread Bath, David
On Tue, 2006-02-14 at 22:12 +0100, Maciej Piekielniak wrote: (snipped) >Is anybody know how create field in a new table with data type accuiring >from a field in other table? >For example: > create table new_table ( name other_table.name%TYPE); On Wed, 15 Feb 2006 09:42, Ken Hill wrote: (snipped)

Re: [SQL] How to implement Microsoft Access boolean (YESNO)

2006-01-29 Thread Bath, David
On Tue, 24 Jan 2006 07:53, Greg Stark wrote: > > Having checked the I/O format it seems that MS Access exports the > > values of a YESNO field as 0 and 1 Hmmm. I may be wrong, but last time I looked (a year or so ago), when I cast MS-Access yes/no fields to numerics, it gave me 0=no or all_bits_o

[SQL] Updatable views: any decent front-ends?

2005-11-24 Thread Bath, David
(As this seems to be the general pg list, I'm posting here even though it is a front-end issue. Apologies.) While I can happily create rules on views to allow inserts, updates and deletes, I can't find a GUI front-end that understands that the view allows record edits that I can run on linux (whe

Re: [SQL] idea for a geographically distributed database: how best to implement?

2005-11-21 Thread Bath, David
On Thu, 17 Nov 2005 19:44, Andy Ballingall wrote: > I've got a database for a website which is a variant of the 'show stuff near > to me' sort of thing. > > Rather than host this database on a single server, I have a scheme in mind > to break the database up geographically so that each one can run

[SQL] selective dump pg_dump: only specific non-tables? with schema name?

2005-11-13 Thread Bath, David
Hi folks, Three questions about pg_dump (that might be a feature request). Let me know if pg_dump is not the best tool for this sort of thing. 1. Can I pg_dump only non-table information from the command line e.g. single function, all functions, trigger definitions? 2. Can I pg_dump schema o

Yes, pg does triggers first before asserting check constraints! Was Re: [SQL] why vacuum

2005-10-26 Thread Bath, David
Tom, After I wrote > > Sybase/MS-SQL's check constraint model asserts the constraint > > BEFORE the trigger, which discourages you from attempting to> > > check and handle meaning of data! you wrote (2005-10-26 17:00) > Er, doesn't PG do it that way too? Well, it works for me! In this case (wit

Re: [SQL] why vacuum

2005-10-25 Thread Bath, David
On Wed, 26 Oct 2005 15:14, Tom Lane wrote: > Kenneth Gonsalves <[EMAIL PROTECTED]> writes: > > (A MySQul guy said, not Kenneth)... > > 'I wouldnt commit mission critical data to a database that needs to be > > vacuumed once a week'. My two-penneth worth... I wouldn't commit mission cri

[SQL] ?Equiv to oracle (ENABLE|DISABLE) (CONSTRAINT|TRIGGER) statements?

2005-10-25 Thread Bath, David
Folks, Summary: Does postgresql have equivalents to the following Oracle statements? DISABLE CONSTRAINT ... ENABLE CONSTRAINT ... DISABLE TRIGGER ... ENABLE TRIGGER ... Background: One of the advantages of Oracle over some competitors such as MS-SQL and Sybase is the ability

[SQL] RULES on SELECT with JDBC/perlDBI from other RDBMS products?

2005-10-06 Thread Bath, David
Folks, I'm looking at using pg to be the main platform for integrating info from other RDBMS products (particularly Oracle) as pg seems to be the most flexible RDBMS around. Disregarding writing to foreign products, query-plan efficiencies, or differences of SQL dialect, I'd like to have a way of

[SQL] Equivalent of Oracle SQL%NOTFOUND in plpgsql

2005-09-05 Thread Bath, David
Folks, Background: I'm an old Oracle PL/SQL guy. In PL/SQL I can write some like the following: fetch cursorblah into blurble; if cursorname%NOTFOUND . or use the more general SQL%NOTFOUND symbol that is not specific to a cursor. There are similar "easy" variables t

[SQL] Tidying values on variable instantiation

2005-08-25 Thread Bath, David
Folks, Preamble: * I can create a check constraint on a column or domain that enforces "no leading or trailing whitespace". Imagine that the domain is called "trimmed_varchar" * I can create plpgsql function/triggers that "tidy" up incoming varchars, trimming the offending whitespaces, on a