Re: [SQL] Tidying values on variable instantiation

2005-08-25 Thread Michael Glaesemann
On Aug 26, 2005, at 12:04 PM, Bath, David wrote: Desired Outcome(s): * I would like to have the convenience of declaring a column that obeys a constraint (similar to using a domain), but allows a "tidy-up" as the value is created BEFORE asserting the constraint. This *might* be term

[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

Re: [SQL] Can EXCEPT Be Used for To Solve This Problem?

2005-08-25 Thread Mark R. Dingee
you can also do select ... order by update_time desc offset 1 limit 1 On Thursday 25 August 2005 10:47 am, Vivek Khera wrote: > On Aug 24, 2005, at 4:47 PM, Lane Van Ingen wrote: > > I want to select 2nd oldest transaction from foo (transaction 3). The > > solution below > > works, but I think t

Re: [SQL] Can EXCEPT Be Used for To Solve This Problem?

2005-08-25 Thread Vivek Khera
On Aug 24, 2005, at 4:47 PM, Lane Van Ingen wrote: I want to select 2nd oldest transaction from foo (transaction 3). The solution below works, but I think there may be a better way. Does anyone else have a better idea? why not just select order by update_time desc limit 2 then discard th

Re: [SQL] How this query!

2005-08-25 Thread Bruno Wolff III
On Thu, Aug 25, 2005 at 18:44:00 +0700, Richard Susanto <[EMAIL PROTECTED]> wrote: > Folks, > would you like help me how to query this case. This question is off topic for the pgsql-admin list, it should have been asked on the pgsql-sql list because it was a question about SQL. (I probably would

Re: [SQL] Number of rows in a cursor ?

2005-08-25 Thread Bruno Wolff III
On Thu, Aug 25, 2005 at 08:51:59 +0200, Bo Lorentsen <[EMAIL PROTECTED]> wrote: > Michael Fuhr wrote: > > >Right -- when you open a cursor PostgreSQL doesn't know how many > >rows it will return. PostgreSQL selects a query plan based on an > >*estimate* of how many rows the query will return, b

Re: [SQL] table listing queries

2005-08-25 Thread Hélder M . Vieira
Namely, in MySQL I can say: "SHOW TABLES FROM 'dbname'" to list tables in a database I'm not currently connected to. In MySQL, table definitions are replicated outside the database files, and might therefore be available without connecting to a specifc database. This probably happens because of

Re: [SQL] table listing queries

2005-08-25 Thread Sean Davis
On 8/25/05 7:13 AM, "Daniel Silverstone" <[EMAIL PROTECTED]> wrote: > Hi, > > I know that questions like this have been asked in the past, but I can > find no definitive answer to one particular part of my problem... > > Namely, in MySQL I can say: "SHOW TABLES FROM 'dbname'" to list tables > in

[SQL] table listing queries

2005-08-25 Thread Daniel Silverstone
Hi, I know that questions like this have been asked in the past, but I can find no definitive answer to one particular part of my problem... Namely, in MySQL I can say: "SHOW TABLES FROM 'dbname'" to list tables in a database I'm not currently connected to. I can find no way of doing this in PgS