 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
HenryMaher
Joined: 15 Oct 2015 Posts: 11
|
|
Edit view (DDL) to notepad ++ keeping on adding brackets |
|
Hi all,
I am using notepad ++ connecting to postgres 9.2 db.
Got sql assistant's database explorer open and am right clicking on a query then edit view.
The code that comes over is the same as from the db but it just has so many brackets around the code.
Especially around how the joins connect, and the where statement
eg
JOIN Sometable t3 ON ((((t1.id = t3.id) AND (somethingelse = 0)) AND (somefield = (-1)))))
WHERE ((t1.somefield = 0) AND (t2.somefield2 = (-1))) AND ....
anyone know how I can stop the parsing doing this?
Have checked the manual for all things DDL but.. well here we are.
|
|
Thu Oct 15, 2015 9:18 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
What do you see in view_definition column in information_schema.views catalog for that particular view? Does it have extra brackets?
 |
 |
select view_definition
from information_schema.views
where
table_schema = ...
and table_name = ... |
|
|
Fri Oct 16, 2015 9:30 am |
|
 |
HenryMaher
Joined: 15 Oct 2015 Posts: 11
|
|
|
|
Yes it does. So Postgres stores it with all the brackets and then PGadmin (which is what I was viewing it through) strips them all out.
Is there any way that SQL Assistant can strip them out.?
The whole reason behind this is that the queries get compared with previous versions which come from pgadmin. Understand that I could use the schema view to get the old data and them compare.
|
|
Sun Oct 18, 2015 7:06 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
the information_schema.views returns view defitnition as it is stored in the system catalog tables. The same should be returned by
 |
 |
SELECT definition
FROM pg_views
WHERE viewname = 'view name here' |
and the same should be returned by
 |
 |
SELECT pg_get_viewdef('view name here', true) |
I guess pgAdmin reconstructs the view definition on it's own that's why it doesn't match the saved definition. I'm afraid there is nothing SQL Assistant can do to match pgAdmin behavior.
Just in case, if you need to compare view definitions across multiple databases or servers, you can use the Schema Compare feature of SQL Assistant.
|
|
Sun Oct 18, 2015 9:44 pm |
|
 |
HenryMaher
Joined: 15 Oct 2015 Posts: 11
|
|
|
|
Just one of those little things.
Thanks for you time and congrats on a very good product. Have been so happy to use.
|
|
Mon Oct 19, 2015 12:45 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|