Re: [GENERAL] PG choosing nested loop for set membership?

2014-03-26 Thread Brian Crowell
On Wed, Mar 26, 2014 at 11:43 AM, Tom Lane wrote: > In principle I guess we could somehow merge the stats of y and z > when looking at a "coalesce(y, z)" expression, but I'm not sure > how that would work exactly. Yeah, I'm not sure there's anything to fix here, either. Just a reminder that coale

Re: [GENERAL] PG choosing nested loop for set membership?

2014-03-26 Thread Brian Crowell
On Wed, Mar 26, 2014 at 10:23 AM, Tom Lane wrote: > Hm. It's not obvious from here that those give the same results --- > but you probably understand your schema better than the rest of us. The _users table has a "user_id", and a nullable column "impersonating" which refers to a user_id you want

Re: [GENERAL] PG choosing nested loop for set membership?

2014-03-26 Thread Brian Crowell
On Tue, Mar 25, 2014 at 5:59 PM, Tom Lane wrote: > Yeah. The weird thing about that is that the nestloop rowcount estimate > isn't the product of the two input rowcounts --- you'd sort of expect an > estimate of 158 given the input-relation sizes. While that's not ipso > facto evidence of a bug

Re: [GENERAL] PG choosing nested loop for set membership?

2014-03-25 Thread Brian Crowell
On Tue, Mar 25, 2014 at 4:12 PM, David Johnston wrote: > 2 - and the one I'd use by default) Use an INNER JOIN That's where I started, but Postgres is smart enough to know that this is equivalent to what I'm doing, and still picks the nested loop. I went to IN in the hopes of tricking it. I have

Re: [GENERAL] PG choosing nested loop for set membership?

2014-03-25 Thread Brian Crowell
On Tue, Mar 25, 2014 at 4:07 PM, Tom Lane wrote: > So the main estimation error is inside that view, which you didn't > show us :-( I didn't know which direction you'd want to go with it. :P The view is like this: === create or replace view pl2.visible_accounts as select -- {{pk}} The acco

[GENERAL] PG choosing nested loop for set membership?

2014-03-25 Thread Brian Crowell
Hello, it's me, a Postgres n00b again. I'm dealing with a query that scans a rather large table (94,000,000 tuples or so) and just picks out certain rows and sums them: select dci.snapshot_time as "time", round(sum(dci.todays_pl)::numeric,0) as pl from dbo._pl_data_cache_intraday dci where dci.sna

Re: [GENERAL] Recovering from failed transaction

2014-03-10 Thread Brian Crowell
On Mon, Mar 10, 2014 at 4:16 PM, Jeff Janes wrote: > ... Or maybe it is mangling the "ROLLBACK;" into some form > the database doesn't recognize. Look in the postgres log files to see what > the events look like from PostgreSQL's perspective. Well that's the clue I needed. I was misinterpreting

[GENERAL] Recovering from failed transaction

2014-03-10 Thread Brian Crowell
I feel dumb asking this question, but I can't seem to find the answer online. I'm running serializable transactions, and so naturally, they will sometimes fail with the error "could not serialize access due to concurrent update." But then I try to issue a ROLLBACK so I can continue using the conn

Re: [GENERAL] GSSAPI/SSPI and mismatched user names

2014-02-24 Thread Brian Crowell
On Mon, Feb 24, 2014 at 1:06 PM, Stephen Frost wrote: > I'm afraid you're going to need to try harder to find out how to get the > Windows GSSAPI/SSPI code to give you the princ. I was actually pretty > sure that GSSAPI defined a way, but I don't know the Windows side of it > or if they decided t

Re: [GENERAL] GSSAPI/SSPI and mismatched user names

2014-02-24 Thread Brian Crowell
On Mon, Feb 24, 2014 at 12:55 PM, Stephen Frost wrote: > * Brian Crowell (br...@fluggo.com) wrote: >> https://github.com/npgsql/Npgsql/issues/162#issuecomment-35916650 > > Reading through this- can't you use GSSAPI to get the Kerberos princ > found the ticket which is c

[GENERAL] GSSAPI/SSPI and mismatched user names

2014-02-24 Thread Brian Crowell
I'm going to file this as a bug as well, but I guess I'm hoping to catch some developers here for discussion. I'm working with the Npgsql group on getting integrated security to "just work" in the same way SQL Server's does. I wrote a workaround for one issue, only to find out that I need more wor

Re: [GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2014-02-21 Thread Brian Crowell
er account with a password that can't change, and then use ktpass to generate a password and create an appropriate keytab. You may or may not be able to use ktpass to set up an SPN, I didn't go about that in an orthodox way. --Brian On Tue, Nov 12, 2013 at 9:13 AM, Brian Crowell wrot

Re: [GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2013-11-12 Thread Brian Crowell
On Tue, Nov 12, 2013 at 5:45 AM, Francisco Figueiredo Jr. wrote: > I'm looking forward your patch. > Npgsql source can be found at github.com/npgsql/Npgsql I figured out the username issue, and so I've sent a pull request: https://github.com/npgsql/Npgsql/pull/95 I encountered an issue where con

Re: [GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2013-11-12 Thread Brian Crowell
On Tue, Nov 12, 2013 at 10:03 AM, Christian Ullrich wrote: > Pseudocode: > > n = GetUserNameEx(NameSamCompatible)// "logon screen" case > NameTranslate.Set(ADS_NAME_TYPE_NT4, n) > n = NameTranslate.Get(ADS_NAME_TYPE_DOMAIN_SIMPLE) // "official" case > n = n.CutAtTheAtSign(

Re: [GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2013-11-12 Thread Brian Crowell
On Mon, Nov 11, 2013 at 11:56 PM, Christian Ullrich wrote: >> On Mon, Nov 11, 2013 at 10:51 PM, Brian Crowell wrote: >> * If I don't specify my username, Npgsql sends it in lowercase "bcrowell" > > Hmm. That is related one problem I've been having with SSPI

Re: [GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2013-11-12 Thread Brian Crowell
On Tue, Nov 12, 2013 at 9:13 AM, Brian Crowell wrote: > net ads keytab add postgres/machinen...@realm.com -U DOMAIN\Administrator > net ads keytab add postgres/machinename.domain@realm.com -U > DOMAIN\Administrator D'oh! These should be: net ads keytab add pos

Re: [GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2013-11-12 Thread Brian Crowell
On Tue, Nov 12, 2013 at 5:45 AM, Francisco Figueiredo Jr. wrote: > It would be awesome if you could write a little guide about how to configure > PostgreSQL to work with sspi authentication from Windows. > I could add it to our Npgsql user manual... A guide will have to wait until I do all this a

Re: [GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2013-11-11 Thread Brian Crowell
On Mon, Nov 11, 2013 at 10:51 PM, Brian Crowell wrote: > I think I'm getting closer though. I have psql on Windows successfully > authenticating, so I can't be too far off. Got it. The NpgsqlPasswordPacket class has a bug: a utility function it calls appends a null character to

Re: [GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2013-11-11 Thread Brian Crowell
On Tue, Nov 5, 2013 at 11:35 AM, Christian Ullrich wrote: > Hence my suspicion that it doesn't. I did not have the time to compare every > function call yet. It doesn't. But it's a pretty close match; it looks like it was ported directly from the libpq code. libpq actually uses the same code path

Re: [GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2013-10-30 Thread Brian Crowell
I've thought of one option, which I'm investigating: implementing GSSAPI support in Npgsql. Microsoft claims this is possible using the SSPI API: http://msdn.microsoft.com/en-us/library/windows/desktop/aa380496(v=vs.85).aspx —Brian On Wed, Oct 30, 2013 at 3:16 PM, Brian Crowell wrot

[GENERAL] GSSAPI server side on Linux, SSPI client side on Windows

2013-10-30 Thread Brian Crowell
Hello again! I've been setting up my PostgreSQL server by doing something I've never done before: I've joined a Linux server to a domain so I can use integrated Kerberos authentication from server to server. I've managed to make this work from Linux machine to Linux machine. On the client, I retr

Re: [GENERAL] Preserving the source code of views

2013-10-20 Thread Brian Crowell
On Sat, Oct 19, 2013 at 11:37 PM, Pavel Stehule wrote: > For my work is very significant @a point - I wrote and I am writing usually > database centric stored procedures centric applications and @a works > perfect. For me a SQL code is code as any other - I use a my favourite > editor, I use a GIT

Re: [GENERAL] Preserving the source code of views

2013-10-20 Thread Brian Crowell
On Sun, Oct 20, 2013 at 7:01 AM, Bill Moran wrote: > You could adjust your workflow to use something like dbsteward: > http://dbsteward.org/ Nifty, but without an editor, I don't think I could convince our developers to author the databases in XML. --Brian -- Sent via pgsql-general mailing li

Re: [GENERAL] Preserving the source code of views

2013-10-20 Thread Brian Crowell
On Sun, Oct 20, 2013 at 4:24 PM, Tom Lane wrote: > No, and it's very unlikely that there ever will be, because it's > completely against the system structure at a number of levels. However, > there's more than one way to skin this cat. Many people keep their DDL as > text in some external CMS, a

[GENERAL] Preserving the source code of views

2013-10-19 Thread Brian Crowell
Hello! I'm evaluating PostgreSQL as a replacement for SQL Server in our in-house systems. I've been really impressed with it so far, and I'm eager to try it with our data sets. I've run across one thing that would make a transfer difficult. Postgres doesn't preserve the source code for views, as f