[GENERAL] C++ Builder prob.

2005-02-07 Thread Teddy
When I try to run something with PostrgreSQL (libpq) in Borland C++ 
Builder, it does not run and write errors like "[Linker Error] 
Unresolved external '_PQconnectdb' referenced from C:\PROGRAM 
FILES\BORLAND\CBUILDER6\PROJECTS\UNIT1.OBJ". Does anybody know how to 
fix it?
Thanks

---(end of broadcast)---
TIP 8: explain analyze is your friend


[GENERAL] Problems with Greatest

2017-02-15 Thread Teddy Schmitz
Hello,


I have a query using Greatest that hangs and never returns when called with two 
tables.


Postgres Version: 9.6


Tables

t1{ id bigint }


t2 { id bigint }


they are sharing a sequence


the query

select greatest(max(t1.id), max(t2.id)) from t1, t2;

The purpose was to call setval on the sequence after doing a bulk data load 
into the database.  But this query never returns.  I have tried it with various 
combinations,

select greatest(max(t1.id), 6) from t1; -> This returns

select greatest(max(t1.id), 6) from t1, t2; -> This never returns.

The query does work if there is only a few hundred items between the tables but 
I'm importing about ~300,000 rows between the two tables.  I looked at 
pg_stat_activity and it says the query is active

I worked around this problem using a union all query but I'm wondering if this 
is a bug or I am just using greatest wrong.



Re: [GENERAL] Problems with Greatest

2017-02-15 Thread Teddy Schmitz
As a quick follow up I just did an explain on the query,


Aggregate  (cost=258007258.87..258007258.88 rows=1 width=8)
->  Nested Loop  (cost=0.00..184292254.83 rows=14743000807 width=16)
->  Seq Scan on t1  (cost=0.00..3796.41 rows=263141 width=8)
->  Materialize  (cost=0.00..1088.40 rows=56027 width=8)
->  Seq Scan on t2  (cost=0.00..808.27 rows=56027 width=8)


It seems it has to do a loop on 14 billion rows?  Can someone explain why this 
would happen?


Thanks,


Teddy

____
From: Teddy Schmitz
Sent: Thursday, February 16, 2017 12:32:41 PM
To: pgsql-general@postgresql.org
Subject: Problems with Greatest


Hello,


I have a query using Greatest that hangs and never returns when called with two 
tables.


Postgres Version: 9.6


Tables

t1{ id bigint }


t2 { id bigint }


they are sharing a sequence


the query

select greatest(max(t1.id), max(t2.id)) from t1, t2;

The purpose was to call setval on the sequence after doing a bulk data load 
into the database.  But this query never returns.  I have tried it with various 
combinations,

select greatest(max(t1.id), 6) from t1; -> This returns

select greatest(max(t1.id), 6) from t1, t2; -> This never returns.

The query does work if there is only a few hundred items between the tables but 
I'm importing about ~300,000 rows between the two tables.  I looked at 
pg_stat_activity and it says the query is active

I worked around this problem using a union all query but I'm wondering if this 
is a bug or I am just using greatest wrong.



Re: [GENERAL] Problems with Greatest

2017-02-15 Thread Teddy Schmitz
Thanks for the link Pavel,  that makes perfect sense now.


Teddy


From: David G. Johnston 
Sent: Thursday, February 16, 2017 12:42:36 PM
To: Teddy Schmitz
Cc: pgsql-general@postgresql.org
Subject: [GENERAL] Problems with Greatest

On Wednesday, February 15, 2017, Teddy Schmitz 
>
 wrote:

select greatest(max(t1.id), max(t2.id)) from t1, t2;

I seriously doubt that the greatest function is a larger contributor to run 
time than the cross join between t1 and t2.

David J.


[GENERAL] setting contrib lo visible to all schemas

2010-05-20 Thread Teddy Limousin
hello I`m trying to restore a database that uses contrib type lo. The
database uses one schema where the relations are created
before restoring the schema I execute the command

psql -d dbname -f path-to-contrib/lo.sql

after this I restore the schema and then the data of the database

the problems comes up when trying to make an update to the database schema
from a delphi application
the table has a column of type lo and when trying to update the table I got
the error saying
that lo type does not exist.

I guess this is because when executing the sql command to install lo, it
makes it visible from the public schema only
not from the schema I`m using. So my question is how can I make lo type to
be visible from all schemas

by visible I mean accesible: not need to use for example public.lo to define
a field of type lo

thanks in advanced

-- 
Teddy L.


Re: [GENERAL] setting contrib lo visible to all schemas

2010-05-20 Thread Teddy Limousin
thanks tom, aparently your rigth in the sql dump file there are some
set search_path changes
I tried the set search_path command and use the same query that generate
the error and it works on my pgadmin editor.

My question is how can I set the search_path for all users or all conections
so my  application will find the lo type.

thanks

2010/5/20 Tom Lane 

> Teddy Limousin  writes:
> > I guess this is because when executing the sql command to install lo, it
> > makes it visible from the public schema only
> > not from the schema I`m using. So my question is how can I make lo type
> to
> > be visible from all schemas
>
> > by visible I mean accesible: not need to use for example public.lo to
> define
> > a field of type lo
>
> It sounds like you removed the public schema from your search_path
> setting.  Don't do that ...
>
>regards, tom lane
>



-- 
Teddy Limousin