Re: [SQL] How to workaround DROP CONSTRAINT [ IF EXISTS ] in Postgres version 8.1?

2011-02-04 Thread Viktor Bojović
use function which searches through this tables:

-pg_constraint
-pg_trigger

On Wed, Feb 2, 2011 at 11:21 PM, creationw
wrote:

>
> Hello,
>
>
> I found that DROP CONSTRAINT [ IF EXISTS ] is available in Postgres 9.1
> http://developer.postgresql.org/pgdocs/postgres/sql-altertable.html
> http://developer.postgresql.org/pgdocs/postgres/sql-altertable.html
>
>
> But it is not avaiable in Postgres 8.1
> http://www.postgresql.org/docs/8.1/interactive/sql-altertable.html
> http://www.postgresql.org/docs/8.1/interactive/sql-altertable.html
>
>
> Is there a way to achieve this on Postgres 8.1?
>
> Thanks a lot
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/How-to-workaround-DROP-CONSTRAINT-IF-EXISTS-in-Postgres-version-8-1-tp3368570p3368570.html
> Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
>
> --
> Sent via pgsql-sql mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>



-- 
---
Viktor Bojović
---
Wherever I go, Murphy goes with me


Re: [SQL] using of select (myfunction()).* is so slow

2011-02-04 Thread Gerardo Herzig
El jue, 03-02-2011 a las 20:47 +0100, Pavel Stehule escribió:
> Hello
> 
> If you use a record expansion over function's result, then function is
> called once for record's field.
> 
> so don't do it on slow functions.
> 
> Regards
> 
> Pavel
> 
> 
> 2011/2/3 Gerardo Herzig :
> > Hi all, im using a function of my own in a subquery, and when wonderig
> > about the slowliness of this one, y relalize that:
> >
> > test=# SELECT (_xxfunction(854,'711H',11,false)).* ;
> > (4 filas)
> > --Result DELETED
> > Duración: 1069,465 ms
> >
> >
> > glyms=# SELECT * from _xxfunction(854,'711H',11,false) ;
> > (4 filas)
> > Duración: 228,699 ms
> >
> > For privacy reasons, i just deleted the result and the function name,
> > but the resulst are obviously exactly the same, and the ().* form (which
> > i needed) is taking so much more...there is a reason why? A workaround?
> >
> > Thanks!
> >
> > Gerardo
> >
> >
> > --
> > Sent via pgsql-sql mailing list ([email protected])
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-sql
> >
> 

M ok Thanks...So there is no workaround/alternative to this?

Gerardo


-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] using of select (myfunction()).* is so slow

2011-02-04 Thread Pavel Stehule
>>
>
> M ok Thanks...So there is no workaround/alternative to this?
>

yes, (SELECT x.* from func(...) x) instead SELECT (func(...)).*

regards

Pavel Stehule

> Gerardo
>
>

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] using of select (myfunction()).* is so slow

2011-02-04 Thread Gerardo Herzig
El vie, 04-02-2011 a las 12:17 +0100, Pavel Stehule escribió:
> >>
> >
> > M ok Thanks...So there is no workaround/alternative to this?
> >
> 
> yes, (SELECT x.* from func(...) x) instead SELECT (func(...)).*
> 
> regards
> 
> Pavel Stehule
> 
> > Gerardo
> >
> >
> 

Great, i will check that. Thanks again Pavel!

Gerardo


-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] How to checking the existance of constraints for a table?

2011-02-04 Thread bricklen
On Wed, Feb 2, 2011 at 12:40 PM, creationw
 wrote:
>
> Hello,
>
> I have a sample table describe as follows, anyone knows how to checking the
> existence of a constraint?
>
> oviddb=# \d myTable
>
>  Column  |   Type   | Modifiers
> -+--+---
>  orderid | smallint | not null
>  modelid | smallint | not null
>
> Indexes:
>    "mytable_orderid_key" UNIQUE, btree (orderid)
>
> For example, how to know that myTable has a constraint with name
> "mytable_orderid_key"?

You could try checking the information_schema.table_constraints view.
Eg. select * from information_schema.table_constraints where
table_name='myTable'

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql