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 cur

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

2006-04-21 Thread George Young
e/infoschema-columns.html -- 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

[SQL] trigger to enforce FK with nulls?

2006-04-12 Thread George Young
rmace should be a problem. 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?&qu

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
le | postgres | public | hold_log | table | postgres | ... But not if you specify the object: newschm3=# \d+ fffg Table "public.fffg" Column | Type | Modifiers | Description +-+---+- t | text|

Re: [SQL] Copying a row within table

2006-03-14 Thread george young
*shares* 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 <[EM

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 differe

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, whi

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 n

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

2006-02-08 Thread george young
ely with the database? Will the planner produce lousy query 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] 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 writes: > > This query returns zero rows: > > > newschm3=# select run_id from s_bake where opset_id not in (select opset_id > > from opset_steps); &

[SQL] trecherous subselect needs warning?

2006-02-07 Thread george young
has any rows! Eeek! I suppose the moral of the story is to ALWAYS, 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 miss

Re: [SQL] PostgreSQL and uuid/guid

2006-01-05 Thread george young
r written a C postgreSQL function, and any help (or > documentation pointout) would be greatly appreciated. > If I posted this to the wrong mailing list, please point me out to the > correct one. You question is quite welcome here! -- George Young -- "Are the gods not just?"

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: >

[SQL] how to convert relational column to array?

2005-12-19 Thread george young
81 | {operator} lawless | 509 | {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?" (

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

2005-12-02 Thread george young
;old_foo')? Does this look useful enough 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

Re: [SQL] problems with array

2005-11-30 Thread george young
(pseudo function? builtin? whatever); no subquery is needed: select c.* from tb_cat c,tb_array a where a.id=1 and c.id=any(a.cat); Look at section 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.postgre

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 writes: > >update steps set x=x||'X' from steps s where steps.key1=s.key1 and > > steps.key2=s.key2 and step.ctid > > But this fails becau

[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 though

[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. I

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

2005-11-08 Thread george young
e table values(owner text, obj text, name text, val text) That is, the values are stored 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 perfo

[SQL] 8.0.x windows installer fails?

2005-10-25 Thread george young
ts adn that you can access it or contact the appilcation 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

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 writes: > > How can I fix this? > > Re-create the owning user (which you evidently dropped), assigning it >

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

2005-10-14 Thread george young
with usesysid=501. There is no row in pg_user with usesysid=101, and there is none with usename "101". How 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&#

Re: [SQL] Rank

2004-05-04 Thread george young
rank from mytable t1,mytable t2 where t2.point >=t1.point group by t1.id,t1.site_name,t1.point; id | 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) -- G

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" > >

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

2004-03-04 Thread george young
e of code did a 'commit', 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 You

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

2003-11-24 Thread george young
thing O(0), i.e. a few queries 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? > > > [postgresq

[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. M

[SQL] backend cpu usage? [7.2]

2003-08-01 Thread george young
and from my app, 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 "

[SQL] find open transactions/locks in 7.2?

2003-06-09 Thread george young
[select version() --> PostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC 3.0.4] I'm getting hangups every day or so, I presume due to some open transaction that insert/update/delete'ed on a table that is used by my main app without a commit. Is there some way (in 7.2!) to find who's locking wha

[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 sid

[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 NO

[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) ) et

[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

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

[SQL] need to join successive log entries into one

2001-03-14 Thread George Young
g the full 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 c

[SQL] plpgsql notify trigger

2001-02-28 Thread George Young
un_name), not the *value* of the variable 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 Youn