[SQL] Re: [ADMIN] DB link from postgres to Oracle; how to query Dbname.tablename?

2013-10-02 Thread Chris Twombly
Do keep in mind that querying across databases generally garners really poor performance, and can bring your application to its knees with astonishing speed. From: pgsql-admin-ow...@postgresql.org [pgsql-admin-ow...@postgresql.org] on behalf of Albe Laur

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

2012-07-10 Thread Chris Preston
Hello all, How far can I get to a higher version of PostgreSQL by just entering a command line instruction to upgrade without any major effort? Regards Chris Preston -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org

Re: [SQL] DELETE FROM takes forever

2011-02-10 Thread Chris Browne
slus...@gmail.com (Josh) writes: > I'm trying to do a DELETE FROM on my large table (about 800 million > rows) based on the contents of another, moderately large table (about > 110 million rows). The command I'm using is: > > DELETE FROM records WHERE id NOT IN (SELECT id FROM unique_records); > >

Re: [SQL] Get postgresql server ip address

2011-02-08 Thread Chris Browne
gerame...@gmail.com (Gera Mel Handumon) writes: > Is it possible to get postgresql server ip address using sql command? You can get the IP address tied to a specific connection... See the function inet_server_port(). Note, however, that the server may have a multiplicity of IP addresses, so th

Re: [SQL] data import

2010-12-21 Thread Chris Ruprecht
If your file is TAB delimited, you can simply do: \copy tablename from 'some file' To get details in psql, do: psql mydatabase and at the prompt: \h copy On Dec 21, 2010, at 06:34 , Viktor Bojović wrote: > Hi, > > can anyone recommend me a windows and linux free tools for importing data > i

[SQL] Create/update trigger auto-populate fields.

2010-12-16 Thread Chris Ruprecht
the person_stamp function, where us_id can be any value in appuser.us_id, other than insert into person (..., us_id) values (..., MyAppUserId ) or update person set ..., us_id = MyAppUserId ...? Thanks, Chris -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to

Re: [SQL] oracle to postgres migration question

2010-06-16 Thread Chris Browne
sfr...@snowman.net (Stephen Frost) writes: > People who are trying to parse psql's output directly should realize > they probably are going about it the wrong way. :) There's a set of people I need to tell that to... -- select 'cbbrowne' || '@' || 'cbbrowne.com'; http://cbbrowne.com/info/internet

Re: [SQL] indexes

2010-01-17 Thread Chris
Seb wrote: Hi, I have some views and queries that take a bit too long to return, so perhaps some judicious indexes might help, but I don't know much about how to use them. The PostgreSQL manual has a good section on indexes, but I can't find guidance on (unless I missed something): o How to de

Re: [SQL] getting extract to always return number of hours

2010-01-05 Thread Chris
Chris wrote: Hi, I'm trying to get extract() to always return the number of hours between two time intervals, ala: => create table t1(timestart timestamp, timeend timestamp); => insert into t1(timestart, timeend) values ('2010-01-01 00:00:00', '2010-01-02 01:00

[SQL] getting extract to always return number of hours

2010-01-05 Thread Chris
Hi, I'm trying to get extract() to always return the number of hours between two time intervals, ala: => create table t1(timestart timestamp, timeend timestamp); => insert into t1(timestart, timeend) values ('2010-01-01 00:00:00', '2010-01-02 01:00:00'); => select timeend - timestart from t

Re: [SQL] PSQL statement to delete 100 rows meeting certain criteria

2009-12-30 Thread Chris Browne
shulkae writes: > I am newbie to postgres/SQL. > > I want to delete all rows exceeding 400 hours (10 days) and I want to > limit deletion of only 100 records at a time. > > I was trying the following in PostgreSQL: > > DELETE from mytable WHERE (now() - timestamp_field > INTERVAL '400 > hour' ) L

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

2009-07-23 Thread Chris
Joshua Tolley wrote: On Thu, Jul 23, 2009 at 02:04:53AM -0400, Glenn Maynard wrote: On Thu, Jul 23, 2009 at 1:31 AM, Richard Huxton wrote: - Let me use SAVEPOINT outside of a transaction, You are never outside a transaction. All queries are executed within a transaction. "Transaction block",

Re: [SQL] Sequences

2009-07-04 Thread Chris Browne
Andre Rothe writes: > Where are stored the sequence information? How I can query the > properties of a sequence like increment, max/min value, cache? > I'm looking for a table like user_sequences in Oracle, where I > can query all of my sequences. cbbrowne=# create sequence foo; CREATE SEQUENCE c

[SQL] freeing memory after fetch all

2009-04-30 Thread Chris Bovitz
should I free the memory allocated for each of the pointers in the char_column array before freeing char_column? : for ( record = 0 ; record < number_fetched ; record++ ) { free ( char_column[record] ) ; } Thanks. Chris -- Chris Bovitz National Operational Hydrologic Remote Sensing Cen

[SQL] Variable number or arguments to a function possible?

2009-04-24 Thread Chris Ruprecht
wnes the phone and so on. How would I declare that function? Thanks. best regards, chris -- chris ruprecht database grunt and bit pusher extraordinaíre -- 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] ENUM vs DOMAIN vs FKyed loookup table

2009-04-15 Thread Chris Browne
ja...@xnet.co.nz (Jasen Betts) writes: > On 2009-04-12, Dirk Jagdmann wrote: >>> When you need to choose between enum types, domain types or lookup >>> tables with foreign keys, what do you usualy choose? >> >> When I have a column with valid values that I know when writing my >> tables and that w

Re: [SQL] postgre2postgre

2009-02-04 Thread Chris
F. wrote: Hello, I am trying to migrate from postgresql-8.1.11-1.el5_1.1 (i386) to postgresql-8.3.4-1.fc10.x86_64. But I can not. Database uses ltree and tsearch and the problem seems to be this. I am using, pg_dump in first computer and psql in second computer to execute script. First error:

Re: [SQL] Any utility to convert MySQL to PGSQL?

2009-01-05 Thread Chris Browne
liaogz82 writes: > I am new to Postgresql. I was wondering is there a way to convert > MySQL to Postgres? Is there a utility in the market that does that? There are many possibilities to choose from: http://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL -- select 'cbbrow

Re: [SQL] Truncate on pg_dump / pg_restore

2008-10-25 Thread chris smith
On Sat, Oct 25, 2008 at 5:32 PM, Bryce Nesbitt <[EMAIL PROTECTED]> wrote: > Dear Postgres Gurus; > > Is there a way to truncate a table, at pg_dump time? > > I'm aware of various ways to exclude a table from a dump (>= 8.2), or to > selectively pg_restore. What I'm seeking here is different. I've

[SQL] Updating Query of 1 table from data in another

2008-10-13 Thread Chris Preston
Hello all, I'm still new to postgres If I have 2 tables with the following data structure Agentno and agentname (along with many other fields) this table is called agent_master And I have another table with agentno and agentname. Table called updatetable When I add data in the updateta

Re: [SQL] replicating a table in several databases

2008-10-10 Thread Chris Browne
[EMAIL PROTECTED] (Gerardo Herzig) writes: > Hi all. Im facing a situation where i have to replicate a table from > database A in databases B,C,F and so on. > > The first (and only) thing i have in mind is using triggers with dblink > for comunications with the other DB's. > > I dont even like the

[SQL] Encrytion in postgres field in table

2008-07-28 Thread Chris Preston
How do I setup a password table that I only want to encrypt 1 field "password"

[SQL] Arrays, types and prodedures

2008-07-25 Thread Chris Hoy
ta type record What am I missing? Chris -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

[SQL] Converting Copy to insert statement in backup file

2008-07-10 Thread Chris Preston
Hello, I have a backup cron job (shown below) but its too big and there are times that I want to just cut out from the text file certain areas to restore data in a specific table. Looking in the file, I notice there is a "copy" command.. Someone told me that there was a parameter that I could use

[SQL] Cross Tab Functions

2008-06-20 Thread Chris Preston
Hello All, I have used the cross tab function to setup tables that display months' data, however i need to display years data instead of the months.. so i would display 2006 as a column, 2007 as a colum and 2008 as a column. when i tried to modify the simple example of the cross tab (shown below)

Re: [SQL] One Text Table or Multiple Text Tables - Design Tradeoffs?

2008-06-10 Thread Chris Browne
[EMAIL PROTECTED] (Bryan Emrys) writes: > (Trying to start a new thread instead of my accidental intrusion into another > thread) > > Hello Everyone, > > In a text-heavy database, I'm trying to make an initial design decision in > the following context. > > There is a lot of long text that I co

[SQL] crosstab functions in postgres 8.1

2008-06-06 Thread Chris Preston
Hello, I am almost a newbie to postgres and only recently found out about one of the greatest function crosstab in postgres. The problem is that I am using 8.1 and when I run the function I am getting an error relating to $libdir/tablefunc.. someone mentioned that it might be because I am usin

Re: [SQL] Find all instances of a column in the entire database.

2008-05-16 Thread Chris Browne
[EMAIL PROTECTED] ("Gavin 'Beau' Baumanis") writes: > I am hoping that you might be able to give me some assistance with the > following task! > I have a database with nearly 200 tables and I need to find all tables > that contain a column of myColumnName. > > I was hoping there might be a built-in

Re: [SQL] Index to enforce non-overlapping ranges?

2008-05-08 Thread Chris Browne
[EMAIL PROTECTED] (James Robinson) writes: > Academic question here: > > Given a table with a pair of any sort of line-segment-esqe > range delimiter columns, is it possible to build a unique index to > enforce non-overlapping ranges? Such as: > > create table test > ( >

Re: [SQL] trigger for TRUNCATE?

2008-01-10 Thread Chris Browne
[EMAIL PROTECTED] (Tom Lane) writes: > Alvaro Herrera <[EMAIL PROTECTED]> writes: >> Gerardo Herzig escribió: >>> Yes, the TRUNCATE statement is not sql ansi, maybe is a more low level >>> thing than i think. > >> TRUNCATE currently does not fire triggers, but that doesn't mean it's >> impossible

Re: [SQL] trigger for TRUNCATE?

2008-01-08 Thread Chris Browne
[EMAIL PROTECTED] (Gerardo Herzig) writes: > Hi all. Acording to the docs, TRUNCATE will not fire a DELETE trigger > on the table being truncated. > There is a way to capture a TRUNCATE in any way? I think there's some sort of "to do" on that... It ought to be not *too* difficult (I imagine!) to

Re: [SQL] Cheers for DISTINCT ON

2008-01-07 Thread Chris Browne
[EMAIL PROTECTED] (Andrew Sullivan) writes: > On Mon, Jan 07, 2008 at 05:02:27PM +0100, Peter Kovacs wrote: >> I just wanted to give my cheers for DISTINCT ON. It is a great >> feature, I've just found a really good use for it. I am just wondering >> why it didn't make it into the standards. > > Li

Re: [SQL] Cheers for DISTINCT ON

2008-01-07 Thread Chris Browne
[EMAIL PROTECTED] (Bruce Momjian) writes: > Peter Kovacs wrote: >> I just wanted to give my cheers for DISTINCT ON. It is a great >> feature, I've just found a really good use for it. I am just wondering >> why it didn't make it into the standards. >> >> On a slightly unrelated note, I had the opp

Re: [SQL] Incomprehensible dogged sort in Merge Join

2007-08-31 Thread Chris Browne
[EMAIL PROTECTED] (Gregory Stark) writes: > "Aleksandr Vinokurov" <[EMAIL PROTECTED]> writes: > >> Gregory Stark wrote: >>> >>> What version are you running with? >> >> 8.0.1, sorry for missing. > > There have been 12 bug-fix releases since then on the 8.0 branch including > updating timezones to r

Re: [SQL] Reporting functions (OLAP)

2007-08-31 Thread Chris Browne
[EMAIL PROTECTED] (Sean Davis) writes: > I am looking for reporting extensions such as windowing, ranking, > leads/lags, etc. for postgresql. A quick google search turned up > some "working on it" type results, but I was wondering if anything > actually existed up to this point? No, nothing exist

Re: [SQL] Database Synchronization

2007-07-18 Thread Chris Browne
[EMAIL PROTECTED] (Richard Huxton) writes: > Jyoti Seth wrote: >> Hello , >> I have two postgres databases on different linux servers. Postgres >> database >> on one server has some tables that needs to be synchronized from the other >> postgres database . What should be the best method for this.

Re: [SQL] Vacation days

2007-06-26 Thread Chris Browne
[EMAIL PROTECTED] (Wei Weng) writes: > On Monday 25 June 2007 15:22, Susan Young wrote: >> Hi Wei, >> That's OK - Enjoy! >> Susan >> >> Wei Weng wrote: >> > Can I take next week off? >> > >> > Thanks! >> > >> > Wei > > hi, susan, a change of plan. :) > > Instead of the whole week, I just wanted to

Re: [SQL] Index Anding

2007-02-01 Thread Chris Browne
[EMAIL PROTECTED] (Andrew Sullivan) writes: >> Does postgres provide 64 bit support? If so is there a precompiled 64 >> bit version for AIX? I have the 32 bit GCC and can compile 32 bit. 64 >> bit GCC I have not gotten stabilized. (I cold use a tip in that >> direction if anyone lese has experience

Re: [SQL] help with version checking

2006-12-29 Thread Chris Dunworth
this: BEGIN; SELECT check_version('1.0.0.0'); -- Do all your updates etc. here -- UPDATE agenda_version SET version = '1.0.0.1' WHERE id =1; COMMIT; HTH. Good luck... -chris Arnau wrote: Hi all, Thanks for all replies, taking into account all your suggestions and my google re

Re: [SQL] help with version checking

2006-12-28 Thread Chris Dunworth
= 1; COMMIT; I tried it with your script and it seemed to work for me. Hope this helps... -chris Arnau wrote: Tom Lane wrote: Arnau <[EMAIL PROTECTED]> writes: I don't want, if it's possible, to create a function. Unlike Oracle, PG makes a strong distinction between

Re: [SQL] Problem inserting composite type values

2006-12-01 Thread Chris Dunworth
Aaron Bono wrote: On 12/1/06, *Stephan Szabo* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote: On Fri, 1 Dec 2006, Chris Dunworth wrote: > Hi all -- > > (huge apologies if this is a duplicate post -- I sent from an > unsubscribed email account

Re: [SQL] Problem inserting composite type values

2006-12-01 Thread Chris Dunworth
Stephan Szabo wrote: On Fri, 1 Dec 2006, Chris Dunworth wrote: Hi all -- (huge apologies if this is a duplicate post -- I sent from an unsubscribed email account before...) I have a problem trying to INSERT INTO a table by selecting from a function that returns a composite type. (I&#

[SQL] Problem inserting composite type values

2006-12-01 Thread Chris Dunworth
olumn, intVal. I'm obviously doing something wrong. Is there some way to format the INSERT so that I can get full rows inserted, with the individual columns separated out properly (e.g. intVal=3, newVal1=30, newVal2=38)? I'm still pretty new to all this, so it could be something simpl

Re: [SQL] planner used functional index in 7.3.6, now does a seq

2006-11-19 Thread Chris Tennant
o get away from building postgresql from source, as I had always done previously. But I'm now a fresh convert to building from source ;-) Thanks again for your help. - Chris Tom Lane wrote: Chris Tennant <[EMAIL PROTECTED]> writes: ... the underlying problem remains: even with th

Re: [SQL] planner used functional index in 7.3.6, now does a seq

2006-11-19 Thread Chris Tennant
the 7.4 databases (I have them running on different machines). Same problem, the query executes on the 7.3 database in 0.13 ms, and on the 7.4 database in 571 ms. Tom Lane wrote: Chris Tennant <[EMAIL PROTECTED]> writes: here's the definition of the function (as immutable):

[SQL] planner used functional index in 7.3.6, now does a seq scan in 7.4.7 after upgrade

2006-11-18 Thread Chris Tennant
27;ve provided all the gory details below. Thank you!! Chris This is the query: SELECT data_stored.id as data_stored_id, patient_data.id as patient_data_id, stereo_image_attribut

Re: [SQL] Database recovery in postgres 7.2.4.

2006-11-02 Thread Chris Browne
"Santosh" <[EMAIL PROTECTED]> writes: > Hi All. > > My setup is as follows: > OS: Sun Solaris 5.8. > Postgres: 7.2.4 > > I have very large database, which contain 15 tables and each table is > contain more than 10,00,000 records. > > My application is parsing text data files and inserting records i

Re: [SQL] Is this a bug? Deleting a column deletes the constraint.

2006-10-12 Thread Chris Browne
[EMAIL PROTECTED] (Joe) writes: > On Thu, 2006-10-12 at 01:25 -0400, Tom Lane wrote: >> It does seem like this is wrong, in view of SQL92's statement about >> ALTER TABLE DROP COLUMN: >> >> 4) If RESTRICT is specified, then C shall not be referenced in >> the of any view desc

Re: [SQL] inner join is much faster! is that right?

2006-09-19 Thread Chris Mair
pplies the filter in a. Can you send the outputs of "explain " for these two and let us know what version of PG this is? Bye, Chris. -- Chris Mair http://www.1006.org ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Substitute a Character

2006-09-06 Thread Chris Mair
/www.postgresql.org/docs/8.1/static/functions-string.html This for example might work for you: select translate('A98526', 'A', '0'); Bye, Chris. -- Chris Mair http://www.1006.org ---(end of broadcast)--- TIP 9: In v

Re: [SQL] About DBlink

2006-08-17 Thread Chris Mair
nk online at http://developer.postgresql.org/cvsweb.cgi/~checkout~/pgsql/contrib/dblink/README.dblink?rev=1.12.4.1;content-type=text%2Fplain Bye, Chris. -- Chris Mair http://www.1006.org ---(end of broadcast)--- TIP 9: In versions below 8.0, th

Re: [SQL] Can't find which return type is incorrect.

2006-08-11 Thread Chris Lukenbill
Let me try this againMy first one got delayed when my gmail defualted to the wrong account.  (the response is inside codeWarrior's message.Thanks,ChrisOn 8/11/06, Chris Lukenbill <[EMAIL PROTECTED]> wrote: On 8/11/06, codeWarrior < [EMAIL PROTECTED]> wrote: Can you sho

[SQL] Can't find which return type is incorrect.

2006-08-11 Thread Chris Lukenbill
there that I'm skeptical about are the timestamp and the numeric.Thanks ahead of time for any ideas,Chris

Re: [SQL] Querying constraints?

2006-08-10 Thread Chris Mair
og.pg_constraint r, > pg_catalog.pg_class c WHERE c.oid = r.conrelid; I forgot to mention, it's tested on 8.1... Bye, Chris. -- Chris Mair http://www.1006.org ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ?

Re: [SQL] Querying constraints?

2006-08-10 Thread Chris Mair
ype as contraint_type, pg_catalog.pg_get_constraintdef(r.oid, true) as constraint_definition FROM pg_catalog.pg_constraint r, pg_catalog.pg_class c WHERE c.oid = r.conrelid; Bye, Chris -- Chris Mair http://www.1006.org ---(end of broadcast)--- TIP

Re: [SQL] Query response time

2006-08-08 Thread Chris Mair
ration strategy. > I know this is long shot but I hope someone can shed some light. If you're on pgsql-performance@postgresql.org as well, we might continue discussion there. Bye :) Chris. -- Chris Mair http://www.1006.org ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] return setof records

2006-07-28 Thread Chris Lukenbill
: On Thu, Jul 27, 2006 at 03:41:31PM -0500, Chris Lukenbill wrote:> Everywhere I've looked the agreement was that making a call to the> function had to be done as follows:>> SELECT * FROM sp_frontalerts_summary(1,'2006-07-27 18:08:09','2006-07-27 > 19:58:15' ) as

[SQL] return setof records

2006-07-27 Thread Chris Lukenbill
port from MS SQL to PostgreSQL on someone else's code is kickin my butt. Thank you in adavance for any help. Chris ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] SQL generator

2006-07-25 Thread Chris Browne
"Bit Byter" <[EMAIL PROTECTED]> writes: > I would like to know what the underlying SQL statement will look > like, so that I can use this knowlege to build a generic parser that > creates SQL statements from the "English like" text, using the > syntax I described above. I seem to recall that Lotus

Re: [SQL] Sequences, values still increased

2006-07-19 Thread Chris Browne
Paul Maier <[EMAIL PROTECTED]> writes: > Hello everybody, > > Why does... > > BEGIN; > SELECT nextval('test.test_seq') AS id; > ROLLBACK; > > ...still increase the sequence after aborting the transaction? This > nextval-command should be reverted after rolling back, right? Same with an > ABORT: > >

Re: [SQL] MS-SQL<->Postgres sync

2006-07-10 Thread Chris Browne
[EMAIL PROTECTED] (Scott Marlowe) writes: > On Mon, 2006-07-10 at 11:25, Andrew Sullivan wrote: >> On Mon, Jul 10, 2006 at 11:27:52AM -0400, Kevin Bednar wrote: >> > Looking to keep 2 databases in sync, at least semi-realtime if possible, >> > although running a batch update every x mins wouldn't

Re: [SQL] Alternative to serial primary key

2006-07-07 Thread Chris Browne
darcy@druid.net ("D'Arcy J.M. Cain") writes: > And even given all of that, I would probably still use serial. >> and has been recommended. But having a hash function over the address >> column as the primary key means I can always regenerate my primary key > > Danger, Will Robinson. The phrase "re

Re: [SQL] Alternative to serial primary key

2006-07-06 Thread Chris Browne
[EMAIL PROTECTED] (Andrew Sullivan) writes: > On Thu, Jul 06, 2006 at 10:16:42PM +1200, David Clarke wrote: >> column that is calculated from another column in the table but I think >> it would still be more effective than a serial id. > > There is the problem that the hash is not proved unique (in

Re: [SQL] Table design question

2006-06-01 Thread Chris Browne
"codeWarrior" <[EMAIL PROTECTED]> writes: > I never use anything other than "id SERIAL NOT NULL PRIMARY KEY" for my > PKEY's -- as an absolute rule -- I guess I am a purist... Everything else > (the other columns) can have unique constraints, etcetera and be FOREIGN > KEYS, etc... > > Try INSER

Re: [SQL] [GENERAL] pgcrypto-crypt

2006-04-10 Thread chris smith
On 4/6/06, AKHILESH GUPTA <[EMAIL PROTECTED]> wrote: > dear all, > i want to encrypt and decrypt one of the fields in my table (i.e-password > field) > i have searched and with the help of pgcrypto package, using function > "crypt", i am able to encrypt my data, > but there is nothing which i fo

Re: [SQL] [GENERAL] pgcrypto-crypt

2006-04-10 Thread Chris
ryption at the script as well as database level why do you need it encrypted? Please do reply-all - you will get a quicker response (from me and the list(s) might have suggestions I don't). On 4/6/06, *chris smith* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote

Re: [SQL] unique constraint instead of primary key? what

2006-02-10 Thread Chris Browne
gry@ll.mit.edu (george young) writes: > On 9 Feb 2006 08:22:59 -0800 > "BigSmoke" <[EMAIL PROTECTED]> threw this fish to the penguins: > >> If my tables have one or more UNIQUE constraints/indices, I still add a >> "id SERIAL PRIMARY KEY" field to most of my tables. This makes >> referencing easier

Re: [SQL] Does VACUUM reorder tables on clustered indices

2005-12-21 Thread Chris Browne
[EMAIL PROTECTED] ("Jim C. Nasby") writes: > On Wed, Dec 21, 2005 at 12:34:12AM +0100, [EMAIL PROTECTED] wrote: >> Hi, >> >> Utilize CLUSTER; (after vacuum) to reorder the data. > > Why would you vacuum when cluster is just going to wipe out the dead > tuples anyway? There is one reason to VACUUM

Re: [SQL] Blank-padding

2005-10-21 Thread Chris Travers
at the implicit rtrimming is going to cause problems in cases where you are trying to do things with fixed-length fields, which is really where one is likely to use bpchar anyway. It is not a showstopper, but I can see why some people don't like it. But can't please everyon

Re: [SQL] pg, mysql comparison with "group by" clause

2005-10-20 Thread Chris Travers
UP BY dept_name; SELECT dept_id, dept_name, count(*) FROM employee_list GROUP BY dept_name, dept_id; SELECT dept_id, MIN(dept_name), count(*) FROM employee_list GROUP BY dept_id; And yes, it is bad design in every case I can think of.// Why is this a problem? Best Wishes, Chris Tra

Re: [SQL] Problem -Postgre sql

2005-10-18 Thread Chris Travers
Correct me if I am wrong, but isn't COALESCE standard in this way? Best Wishes, Chris Travers Metatron Technology Consulting Michael Glaesemann wrote: [Please do not email me directly. Please post to the list so others may help and benefit from the discussion.] On Oct 19, 2005, at

Re: [SQL] changing a column's position in table, how do you do that

2005-09-27 Thread Chris Browne
[EMAIL PROTECTED] (Ferindo Middleton Jr) writes: > Is there a way to change the position attribute of a column in a > table? I have data that I need to import into various tables in my db > on a consistent basis... I usually us e the COPY ... FROM query but I > can't control the -order- of the fiel

Re: [SQL] add column if doesn't exist

2005-09-27 Thread Chris Browne
[EMAIL PROTECTED] ("Brandon Metcalf") writes: > p == [EMAIL PROTECTED] writes: > > p> Brandon Metcalf wrote: > p> > Is there a way to check for the existence of a column in a table > p> > other than, say, doing a SELECT on that column name and checking the > p> > output? > > p> SELECT * FROM

Re: [SQL] Possible to delete record from all tables at the same time?

2005-09-26 Thread Chris Browne
[EMAIL PROTECTED] writes: > Is it possible to delete a record from all tables in the database at > the same time, without having to execute a separate "DELETE" statement > for each table? > > I have a situation where I need to delete user records from our system. > The user account information is s

Re: [SQL] stored procs in postgresql

2005-09-24 Thread Chris Browne
[EMAIL PROTECTED] writes: > I have been having some trouble with plsql stored procs in postgres in > that I can > make a table name a variable in the stored proc. Is there some > special way to make this happen that I am unaware of? > > For example, I want to do something like: > > stored_proc(in

Re: [SQL] R-tree and start/end queries

2005-09-21 Thread Chris Mungall
eature AS 'SELECT feature.* FROM feature INNER JOIN featureloc AS x ON (x.feature_id=feature.feature_id) INNER JOIN featureloc AS y ON (y.feature_id=$1) WHERE x.srcfeature_id = y.srcfeature_idAND ( x.fmax < y.fmin OR x.fmin > y.fmax ) ' LANGUAGE 'sql&

Re: [SQL] insert only if conditions are met?

2005-09-05 Thread Chris Travers
INTO table_a SELECT firstname, lastname FROM table_b WHERE table_b IN (SELECT id FROM (SELECT id, sum(labor) as total_hours from table_c group by id) WHERE total_hours <> n); Best Wishes, Chris Travers Metatron Technology Consulting begin:vcard fn:Chris Travers n:Travers;Chris email;internet:

Re: [SQL] nullif('','') on insert

2005-08-26 Thread Chris Travers
nt to various snippets. I'd rather just alter the nullif function. SELECT NULLIF('' = '', TRUE); Does this work? You could write a wrapper function if necessary. Best Wishes, Chris Travers Metatron Technology Consulting ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] booleans and nulls

2005-08-26 Thread Chris Travers
need a couple with a true/false value. I'm not joining tables on NULLS, just filtering w/ them. Sounds like a partial index would be your best bet. Something like: CREATE index ON my_table WHERE my_bool IS NOT NULL Best Wishes, Chris Travers Metatron Technology Consulting --

[SQL] Common patterns for 'store' functions

2005-08-26 Thread Chris Mungall
uto-generate some of these functions? Or even super-clever middleware that can decide whether to do it in the application layer or autogenerate some helper functions...? Cheers Chris ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ?

Re: [SQL] Tidying values on variable instantiation

2005-08-26 Thread Chris Browne
[EMAIL PROTECTED] ("Bath, David") writes: > Question(s): > * Am I being realistic, or should I grit my teeth and clone code from > trigger to trigger and column to column? > * Is this something I should try and do using domains, types and > cast functions from "text" or some horrible combinatio

Re: [SQL] Tidying values on variable instantiation

2005-08-26 Thread Chris Browne
[EMAIL PROTECTED] ("Greg Patnude") writes: > Data validation and purification should be performed at the > application layer -- you should format your data appropriately > BEFORE trying any INSERT/UPDATE operations. It seems to me that one might create some stored functions that can do some valida

Re: [SQL] How to secure PostgreSQL Data for distribute?

2005-08-17 Thread Chris Travers
is no good way to do this. If you are worried about this, the technology isn't going to save you. No technology will save you. Instead, I would highly suggest discussing the matter with an attourney and see if there is a legal remedy that might provide adequate protection. Best Wishes,

Re: [SQL] Trigger on select?

2005-08-02 Thread Chris Travers
ead. It may require some editing. Best Wishes, Chris Travers Metatron Technology Consulting ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] Calling SQL functions that return sets

2005-08-01 Thread Chris Mungall
On Mon, 1 Aug 2005, Tom Lane wrote: > Chris Mungall <[EMAIL PROTECTED]> writes: > > What are the reasons for deprecating the use of the function in the > > SELECT clause? > > The semantics of having more than one set-returning function in the > target list are, um

[SQL] Calling SQL functions that return sets

2005-08-01 Thread Chris Mungall
semantics, and not have my code break with some future postgres version. What are the reasons for deprecating the use of the function in the SELECT clause? Am I missing something obvious? Thanks for any insight -- Chris Mungall ---(end of broadcast)--

Re: [SQL] REINDEX DATABASE

2005-07-27 Thread Chris Browne
[EMAIL PROTECTED] (Achilleus Mantzios) writes: > O Chris Browne έγραψε στις Jul 26, 2005 : >> You can get a savings of about 4% of the space, but at the cost of >> taking an appreciable outage during which the database is not usable. > > 1st not all database is unusable, durin

Re: [SQL] REINDEX DATABASE

2005-07-26 Thread Chris Browne
[EMAIL PROTECTED] (Achilleus Mantzios) writes: > O Christopher Browne έγραψε στις Jul 26, 2005 : > >> > Hello >> > >> > Would you like to advice to use REINDEX DATABASE on regular basis ? >> > >> > if (yes) >> > how it should be connected with VACUUM FULL ANALYZE which is run >> > regularly ? (rei

Re: [SQL] solved: Coalesce() in outer join between views

2005-07-24 Thread Chris Travers
Hi all; I found the problem (stupid human error ;-) ) Basically it was a broken join condition. Best Wishes, Chris Travers Metatron Technology Consulting begin:vcard fn:Chris Travers n:Travers;Chris email;internet:[EMAIL PROTECTED] x-mozilla-html:FALSE version:2.1 end:vcard

Re: [SQL] difference between all RDBMSs

2005-07-19 Thread Chris Travers
d), the trigger vs. rule systems in PostgreSQL (warning MS SQL uses something they call rules but it is something different), and features like inherited tables. Again, read the online documentation. Best Wishes, Chris Travers Metatron Technology Consulting ---(e

[SQL] Coalesce() in outer join between views

2005-07-19 Thread Chris Travers
m seems to be somehow assuming that all amount columns in day_source_pre are null. Is there something wrong in how this view is working, or is it (more likely) my SQL syntax? That I want to do is fill in a value from day_inc_source if and only if it is not found in day_source_pre with the sam

Re: [SQL] Make COUNT(*) Faster?

2005-07-07 Thread Chris Browne
[EMAIL PROTECTED] (Varun Mehta) writes: > If I run an EXPLAIN on this query I can see that it is doing a > sequential scan, which seems quite needless, as surely this > information is cached in some secret location. That would in fact surely *NOT* be the case. If you have multiple users performin

Re: [SQL] Does Postgresql have a similar pseudo-column "ROWNUM" as

2005-05-18 Thread Chris Browne
[EMAIL PROTECTED] (Alain) writes: > Andrew Sullivan escreveu: >> On Thu, May 12, 2005 at 01:07:00PM -0600, [EMAIL PROTECTED] wrote: >> >>>Does Postgresql have a similar pseudo-column "ROWNUM" as Oracle? If >>>so, we can write the following query: >> No. What is the purpose of your query? You coul

Re: [SQL] Record Log Trigger

2005-05-02 Thread CHRIS HOOVER
get the current clock time: to_char(to_timestamp(timeofday(),\'Dy Mon DD HH24:MI:SS.US \') HTH, Chris --( Forwarded letter 1 follows )- Date: Mon, 02 May 2005 16:10:46 -0300 To: [EMAIL PROTECTED] From: [EMAIL PROTECTED] Sender: [EMAIL PROTECTED] Sub

Re: [SQL] Debet-Credit-Balance Calculation

2005-04-20 Thread Chris Browne
[EMAIL PROTECTED] ("Muhyiddin A.M Hayat") writes: >> There is an easy way to do this; write a plpgsql set returning >> function which adds the balance to the last column of the table. That >> query will always have a cost in both time and memory proportional to >> the size of the table, and the me

Re: [SQL] unsubscribe pgsql-sql

2005-03-31 Thread Chris Hebrard
Robin M. wrote: unsubscribe pgsql-sql ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org roger doger, copy that tower 2, bravo delta. -- No virus found in this outgoing message. Checked b

Re: [SQL] New record position

2005-03-31 Thread Chris Browne
[EMAIL PROTECTED] ("Greg Patnude") writes: > There's a difference between "natural" order (the location in the > database or on disk) and "record" order (the order specified by the > primary key)... That's well and fine; I could see the "natural order" in which data is returned varying over time i

Re: [SQL] New record position

2005-03-30 Thread Chris Browne
[EMAIL PROTECTED] writes: > Why it? I can't undestand why the new record location was change. Shouldn't it > apper at the LAST record??? > What need I do?? SQL only imposes an order on the return set if you add an "ORDER BY" clause. You can't expect any particular order to either recur or NOT rec

Re: [SQL] Way to stop recursion?

2004-11-29 Thread Chris Travers
P installations but the data is not generally being updated there.) In this case, I would create a view (with appropriate rules) which would automatically populate the common fields from the parent if it exists. The issue should not be one of storage but of presentation. Best Wishes, Chris T

Re: [SQL] help on a query

2004-10-08 Thread CHRIS HOOVER
Just curious, what is wrong with the first way of coding the solution? --( Forwarded letter 1 follows )- Date: Fri, 8 Oct 2004 08:44:23 +0400 To: Thomas.F.O'[EMAIL PROTECTED], [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] From: [EMAIL PROTECTED] Sender: [EMAIL PROTECTE

  1   2   3   >