Re: [SQL] viewing the description of tables from python DB-API

2006-08-07 Thread George Young
On Tue, 1 Aug 2006 15:30:48 -0700 Daniel Joo [EMAIL PROTECTED] wrote: Is there a way to view the list of all tables from python (or any other languages for that matter) DB-API? What I'm looking for is a command similar to the meta-command '\d' that works with the psql client. The cursor

Re: [SQL] find all tables with a specific column name?

2006-04-21 Thread George Young
-- George Young On Fri, 21 Apr 2006 09:29:33 -0700 (PDT) Jeff Frost [EMAIL PROTECTED] wrote: Is there a reasonable way to extract a list of all tables which contain a specific column name from the system views on 8.1? For instance, I might want to enumerate all tables with a column named

[SQL] trigger to enforce FK with nulls?

2006-04-12 Thread George Young
. No updates are ever made to steps.opset and steps.step, or to opset_steps.(opset,step) [though updates are often made to *other* fields of steps]. -- George Young -- Are the gods not just? Oh no, child. What would become of us if they were? (CSL) ---(end of broadcast

Re: [SQL] Expressing a result set as an array (and vice versa)?

2006-03-25 Thread george young
On Thu, 23 Mar 2006 11:44:32 -0800 Don Maier [EMAIL PROTECTED] threw this fish to the penguins: Is it possible to construct an array from an appropriate select expression that generates a result set of unknown cardinality? To focus on the simple case: Is it possible to construct a one-

Re: [SQL] Custom type

2006-03-24 Thread george young
the object: newschm3=# \d+ fffg Table public.fffg Column | Type | Modifiers | Description +-+---+- t | text| | i | integer | | This seems a bit like a bug to me... -- George Young stage=# comment on table

Re: [SQL] Copying a row within table

2006-03-14 Thread george young
* the sequence. insert into foo select * from foo_tmp; drop table foo_tmp; If there's any chance of concurrent update/insert/deletes to foo, you might should wrap this in a (begin; stuff; commit) transaction. -- George Young On Tue, 14 Mar 2006 09:19:49 +0200 Aarni Ruuhimäki [EMAIL PROTECTED] threw

Re: [SQL] Change date format through an environmental variable?

2006-03-02 Thread george young
Try the PGDATESTYLE environment variable. Works in 7.4 and 8.1, though it is claimed to be deprecated. -- George Young On Wed, 01 Mar 2006 12:32:26 -0500 Mark Fenbers [EMAIL PROTECTED] threw this fish to the penguins: I want to get Pg (v7.4.7) to output a date field in a different format

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

2006-02-09 Thread george young
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 and faster. It also improves consistency, which is

[SQL] unique constraint instead of primary key? what disadvantage(ODBC usage)?

2006-02-08 Thread george young
plans? Will Edgar Codd haunt my dreams? -- George Young -- Are the gods not just? Oh no, child. What would become of us if they were? (CSL) ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

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

2006-02-08 Thread george young
On Wed, 08 Feb 2006 18:34:22 -0800 Ken Hill [EMAIL PROTECTED] threw this fish to the penguins: On Wed, 2006-02-08 at 21:04 -0500, george young wrote: [PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1] I'm designing a completely new schema for my database. A major

[SQL] trecherous subselect needs warning?

2006-02-07 Thread george young
, absolutely ALWAYS qualify a correlation name (table alias). Of course, what I meant in the original query was: select s.run_id from s_bake s where s.opset_id not in (select os.opset_id from old_opset_steps os); Sigh. Am I missing something here? -- George Young -- Are the gods not just? Oh

Re: [SQL] trecherous subselect needs warning?

2006-02-07 Thread george young
On Tue, 07 Feb 2006 12:45:53 -0500 Tom Lane [EMAIL PROTECTED] threw this fish to the penguins: george young gry@ll.mit.edu writes: This query returns zero rows: newschm3=# select run_id from s_bake where opset_id not in (select opset_id from opset_steps); run_id (0 rows

Re: [SQL] PostgreSQL and uuid/guid

2006-01-05 Thread george young
mailing list, please point me out to the correct one. You question is quite welcome here! -- George Young -- Are the gods not just? Oh no, child. What would become of us if they were? (CSL) ---(end of broadcast)--- TIP 4: Have you searched our list

[SQL] how to convert relational column to array?

2005-12-19 Thread george young
| {operator,originator} lcalvet | 622 | {originator} loomis | 514 | {operator,originator} pig | 614 | {operator,originator,supervisor} -- George Young -- Are the gods not just? Oh no, child. What would become of us if they were? (CSL) ---(end of broadcast

Re: [SQL] how to convert relational column to array?

2005-12-19 Thread george young
On Mon, 19 Dec 2005 09:54:49 -0700 Michael Fuhr [EMAIL PROTECTED] threw this fish to the penguins: On Mon, Dec 19, 2005 at 11:06:12AM -0500, george young wrote: create table new_tab(name text, id int, permits text[]); -- I insert one row per name: insert into new_tab select distinct

[SQL] rename idx's with table; avoid confusing idx names?

2005-12-02 Thread george young
for me to package more formally? -- George Young CREATE or REPLACE FUNCTION rename_table_and_indexes(old_name text, new_name text) returns void AS $$ declare prefix_len integer; r record; begin

Re: [SQL] problems with array

2005-11-30 Thread george young
8.10.5 Searching in Arrays in http://www.postgresql.org/docs/7.4/interactive/arrays.html and section 9.17.3 in: http://www.postgresql.org/docs/7.4/interactive/functions-comparisons.html -- George Young -- Are the gods not just? Oh no, child. What would become of us if they were? (CSL

[SQL] tid_le comparison for tuple id (ctid) values?

2005-11-21 Thread george young
[PostgreSQL 8.1.0 on i686-pc-linux-gnu] I would like to suggest that there be a less-than (or greater-than) operator for the 'tid' type. I used to use oid's for finding and distinguishing duplicate data. Now that oid's are not included by default (and I do not quarrel with that change), I

Re: [SQL] tid_le comparison for tuple id (ctid) values?

2005-11-21 Thread george young
On Mon, 21 Nov 2005 16:19:28 -0500 Tom Lane [EMAIL PROTECTED] threw this fish to the penguins: george young gry@ll.mit.edu writes: update steps set x=x||'X' from steps s where steps.key1=s.key1 and steps.key2=s.key2 and step.ctids.ctid; But this fails because there is no less-than

[SQL] how to update table to make dup values distinct

2005-11-10 Thread george young
[PostgreSQL 7.4RC2 on i686-pc-linux-gnu](I know, I know... must upgrade soon) I have a table mytable like: i | txt ---+--- 1 | the 2 | the 3 | rain 4 | in 5 | mainly 6 | spain 7 | stays 8 | mainly 9 | in I want to update it, adding a ':' to txt so that each txt value is unique.

Re: [SQL] Design question: Scalability and tens of thousands of

2005-11-08 Thread george young
in text type, not the native type. Yes, this takes a performance hit for conversion of values, but the simplicity of schema really wins for me. I suggest you seriously consider it unless you need blinding performance in all 20,000 applications... -- George Young -- Are the gods not just? Oh

[SQL] 8.0.x windows installer fails?

2005-10-25 Thread george young
vendor to verify that this is a valid Windows Installer package. So I tried the analgous file from 8.0.3, with the same results. What am I doing wrong? -- George Young -- Are the gods not just? Oh no, child. What would become of us if they were? (CSL) ---(end

[SQL] owner of data type areas appears to be invalid ?

2005-10-14 Thread george young
can I fix this? I must be able to get clean dumps that can be reloaded in case of a crash. -- George Young pig5= select * from pg_class where relname='areas'; relname | relnamespace | reltype | relowner | relam | relfilenode | relpages | reltuples | reltoastrelid | reltoastidxid | relhasindex

Re: [SQL] owner of data type areas appears to be invalid ?

2005-10-14 Thread george young
Yes, that worked. Thank you very much! -- George On Fri, 14 Oct 2005 12:04:13 -0400 Tom Lane [EMAIL PROTECTED] threw this fish to the penguins: george young gry@ll.mit.edu writes: How can I fix this? Re-create the owning user (which you evidently dropped), assigning it sysid 101. PG

Re: [SQL] Rank

2004-05-04 Thread george young
| site_name | point | rank +---+---+-- 3 | Site D|22 |4 2 | Site B|90 |2 4 | Site X|98 |1 1 | Site A|40 |3 (4 rows) -- George Young -- Are the gods not just? Oh no, child. What would become of us if they were? (CSL

Re: [SQL] debugging query to put message in pg logfile?

2004-03-05 Thread george young
On Thu, 04 Mar 2004 16:35:01 -0500 Tom Lane [EMAIL PROTECTED] threw this fish to the penguins: george young [EMAIL PROTECTED] writes: I've started putting debugging queries like: select opwin.py: committing step signoff in my app, just to have an entry in the postgres logfile

[SQL] debugging query to put message in pg logfile?

2004-03-04 Thread george young
', since there's nothing to distinguish one from another in the log. Is there some cheaper (or more appropriate) sql statement that will show up in the postgres log? I thought I remembered a message sql statement or something like that. -- George Young -- Are the gods not just? Oh no, child

Re: [SQL] increment int value in subset of rows?

2003-11-24 Thread george young
regardless of the number of rows... - Original Message - From: george young To: [EMAIL PROTECTED] Sent: Monday, November 24, 2003 1:59 AM Subject: [SQL] increment int value in subset of rows? [postgresql 7.4, SuSE x86 linux] I have a table rtest with primary key (run

[SQL] increment int value in subset of rows?

2003-11-23 Thread george young
[postgresql 7.4, SuSE x86 linux] I have a table rtest with primary key (run,seq) and other data. For a given value of run, seq is a sequential run of integers, 1,2,3,4.. Now I want to insert a row into this sequence, say run='foo', seq=2, adjusting the seq up for all subsequent foo rows. My

[SQL] backend cpu usage? [7.2]

2003-08-01 Thread george young
, though it would be nicer to get it directly through sql. -- George Young -- I cannot think why the whole bed of the ocean is not one solid mass of oysters, so prolific they seem. Ah, I am wandering! Strange how the brain controls the brain! -- Sherlock Holmes in The Dying Detective

[SQL] Design Q.:logic in app or db?

2003-02-26 Thread george young
I have general design question about Postgres usage: How does one decide how much, and what parts of logic should go in DB rules, triggers, functions, constraints etc, versus what should go in the application? I see postings here from people who obviously have a lot of domain logic in the DB

[SQL] design question: status table+log table, indexes, triggers

2003-02-05 Thread george young
[postgresql-7.2, pgsql, linux] Here's a schema-design problem I've hit a few times -- it seems like there should be a better way: I have a machine table (140 rows), currently very static: machine(machine_name text NOT NULL, machine_id smallint NOT NULL, area text NOT NULL, text text

[SQL] int id's helpful for indexing, or just use text names?

2002-10-15 Thread george young
[linux, postgresql 7.2, 500MHz * 4 xeon cpu's, 1GB ram, hardware raid] My current db has serveral instances of something like: table foos(fooid int2, fooname text, foouser text, foobar int2 references bars(barid)) table bars(barid int2, barname text, barcolor text, primary key(barid) )

[SQL] select question

2002-08-28 Thread george young
[postgreql 7.2, linux] I have a table T with columns run, wafer, and test: T(run text, wafer int, test text) Given a run and a set of wafers, I need the set of tests that match *all* the specified wafers: run wafer test a 1 foo a 2 foo a 3 foo a

[SQL] need to join successive log entries into one

2001-03-14 Thread George Young
span of time. Null 'done' just means it's not done yet. Unfortunately, the start time of a 'succesive' op is sometimes 1 second later that the 'done' time of the previous one, so maybe using the seq field is simpler. Can anyone think of a way I can do this in postgres? -- George Young, Rm

Re: [SQL] need to join successive log entries into one

2001-03-14 Thread George Young
On Wed, 14 Mar 2001, you wrote: On 3/14/01, 5:24:12 PM, George Young [EMAIL PROTECTED] wrote regarding [SQL] I need to join successive log entries into one: I have a table like: run | seq | start| done 1415|261| 2001-01-29 12:36:55| 2001-02-07 13:02:38

[SQL] plpgsql notify trigger

2001-02-28 Thread George Young
ariable nm, is passwd to the notify command. Since notify only takes a name, not a string, I don't see how to proceed. Is there some way in plsql to construct a string and have it executed in sql? disappointed in plsql, George -- George Young, Rm. L-204[EMAIL PROT