Re: [SQL] select based on multi-column primary keys

2007-01-19 Thread Richard Broersma Jr
> SELECT * FROM iopoints WHERE systemid=123 AND enclosureid='ab' AND pointid=56 A slight variation of the syntax would be: select * from iopoints where (systemid, enclosureid, pointid) = (123,'ab',56); this table and fields sounds alot like a control system be being modeled. :-) Regards, Richa

Re: [SQL] select based on multi-column primary keys

2007-01-19 Thread codeWarrior
-- AFAIK: You cannot have multiple primary keys. How would you know which one is the actual key ? FYI: What you are really talking about are table contraints... When you have multiple unique column constraints -- they are generally referred to as "table constraints" not multiple primary keys

Re: [SQL] select based on multi-column primary keys

2007-01-19 Thread Bruno Wolff III
On Fri, Jan 19, 2007 at 16:44:50 -0800, mawrya <[EMAIL PROTECTED]> wrote: > I have set up a table with a multi-column primary key constraint: > > If I had a row in the table where systemid=123, enclosureid=ab, > pointid=56, I would have a Primary Key ("ID") of 123ab56 for that row. > > I now w

[SQL] select based on multi-column primary keys

2007-01-19 Thread mawrya
I have set up a table with a multi-column primary key constraint: CREATE TABLE iopoints ( enclosureid numeric(3) NOT NULL, pointid char(4) NOT NULL, equipmentgroup varchar(64) NOT NULL, deviceid varchar(8), devicetype varchar(24), operationdesc varchar(64) NOT NULL, entrytime timestamp NOT

Re: [SQL] Permissions Query?

2007-01-19 Thread Andrew Sullivan
On Fri, Jan 19, 2007 at 07:11:00PM +, [EMAIL PROTECTED] wrote: > I now want to know if the user/role has permision > to the schema.table. > > How do I query to pgsql to know what permissions a > particular user has on the table? Start here: http://www.postgresql.org/docs/8.1/interactive/func

[SQL] Permissions Query?

2007-01-19 Thread paallen
Hi all, still working on dabo a bit. Thanks for all the earlier suggestions, they are working well. I now want to know if the user/role has permision to the schema.table. How do I query to pgsql to know what permissions a particular user has on the table? I was thinking something along the line

Re: [SQL] Query to return schema/table/columname/columntype

2007-01-19 Thread codeWarrior
You mean like this: CREATE OR REPLACE VIEW sys_tabledef AS SELECT columns.table_catalog, columns.table_schema, columns.table_name, columns.column_name, columns.ordinal_position, columns.column_default, columns.is_nullable, columns.data_type, columns.character_maximum_length, columns.character

Re: [SQL] Query to return schema/table/columname/columntype

2007-01-19 Thread chester c young
> I am trying to modify the dabo (a python wxpython > ide for database forms creation) code to allow the > selection of tables in any schema. I need a query > that will return records with schema, table, > columname and columne type. create view pg_cols as select s.nspname as schema_nm,

Re: [SQL] Query to return schema/table/columname/columntype

2007-01-19 Thread Bruno Wolff III
On Fri, Jan 19, 2007 at 12:41:19 +, [EMAIL PROTECTED] wrote: > For background I am selecting table & schema by > the query: > SELECT schemaname || '.' || tablename AS tablename > FROM pg_tables ORDER BY tablename; Are you guaranteed that all of the names are lower case? If not you may want t

Re: [SQL] Query to return schema/table/columname/columntype

2007-01-19 Thread paallen
Hi all, I think I have fixed my own problem. At: http://developer.postgresql.org/~momjian/upgrade_tips_7.3 I found the answer which was: SELECT a.attrelid as oid, a.attname, t.typname FROM pg_attribute a inner join pg_type t on a.atttypid = t.oid WHERE a.attrelid = 'co.hole_tes

Re: [SQL] Postgresql & Oracle Heteregenous services - strange behaviour

2007-01-19 Thread Marcin Stępnicki
Dnia Wed, 17 Jan 2007 13:04:28 +, Richard Huxton napisał(a): > That'd be my guess. And then it's not fetching any rows, expecting > cursor-like behaviour. Of course we fetch all the rows before returning > any results. > > The real solution would be to add "LIMIT 0" or "LIMIT 1" to the > c

[SQL] Query to return schema/table/columname/columntype

2007-01-19 Thread paallen
Hi all, I am trying to modify the dabo (a python wxpython ide for database forms creation) code to allow the selection of tables in any schema. I need a query that will return records with schema, table, columname and columne type. For background I am selecting table & schema by the query: SELEC