Index: EOAccess/EOSQLExpression.m =================================================================== --- EOAccess/EOSQLExpression.m (revision 40502) +++ EOAccess/EOSQLExpression.m (working copy) @@ -1784,7 +1784,7 @@ } else { - NSString* columnName = [attribute columnName]; + NSString* columnName = [self sqlStringForSchemaObjectName: [attribute columnName]]; if (columnName == nil) { [NSException raise: @"NSIllegalStateException" @@ -1795,7 +1795,7 @@ if (![self useAliases]) sqlString = columnName; else - sqlString = [@"t0." stringByAppendingString:[self sqlStringForSchemaObjectName:columnName]]; + sqlString = [@"t0." stringByAppendingString:columnName]; } EOFLOGObjectLevelArgs(@"EOSQLExpression", @"sqlString=%@", sqlString); Index: EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m =================================================================== --- EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m (revision 40502) +++ EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m (working copy) @@ -1471,7 +1471,7 @@ fd = lo_open(_pgConn, oid, INV_READ|INV_WRITE); if (fd < 0) [NSException raise: PostgreSQLException - format: @"cannot open large object Oid = %ld", oid]; + format: @"cannot open large object Oid = %u", oid]; lo_lseek(_pgConn, fd, 0, SEEK_END); len = lo_tell(_pgConn, fd); @@ -1479,7 +1479,7 @@ if (len < 0) [NSException raise: PostgreSQLException - format: @"error while getting size of large object Oid = %ld", oid]; + format: @"error while getting size of large object Oid = %u", oid]; bytes = NSZoneMalloc(zone, len); wrt = lo_read(_pgConn, fd, bytes, len); @@ -1488,7 +1488,7 @@ { NSZoneFree(zone, bytes); [NSException raise: PostgreSQLException - format: @"error while reading large object Oid = %ld", oid]; + format: @"error while reading large object Oid = %u", oid]; } lo_close(_pgConn, fd); @@ -1519,13 +1519,13 @@ fd = lo_open(_pgConn, oid, INV_READ|INV_WRITE); if (fd < 0) [NSException raise: PostgreSQLException - format: @"cannot open large object Oid = %ld", oid]; + format: @"cannot open large object Oid = %u", oid]; wrt = lo_write(_pgConn, fd, (char *)bytes, len); if (len != wrt) [NSException raise: PostgreSQLException - format: @"error while writing large object Oid = %ld", oid]; + format: @"error while writing large object Oid = %u", oid]; lo_close(_pgConn, fd); @@ -1556,13 +1556,13 @@ fd = lo_open(_pgConn, oid, INV_READ|INV_WRITE); if (fd < 0) [NSException raise: PostgreSQLException - format: @"cannot open large object Oid = %ld", oid]; + format: @"cannot open large object Oid = %u", oid]; wrt = lo_write(_pgConn, fd, (char*)bytes, len); if (len != wrt) [NSException raise: PostgreSQLException - format: @"error while writing large object Oid = %ld", oid]; + format: @"error while writing large object Oid = %u", oid]; lo_close(_pgConn, fd); @@ -2216,6 +2216,7 @@ NSDictionary *pk = nil; NSArray *primaryKeyAttributes = [entity primaryKeyAttributes]; EOAttribute *primAttribute; + EOSQLExpression *sqlExpr; NSString *sqlString; NSNumber *pkValue = nil; NSString *sqlFormat = nil; @@ -2233,12 +2234,14 @@ return nil; // We support only number keys } - sqlFormat=[NSString stringWithFormat: @"SELECT nextval('%@')", - [(PostgreSQLAdaptor*)[[self adaptorContext]adaptor] primaryKeySequenceNameFormat]]; - + sqlExpr = [EOSQLExpression sqlExpressionWithEntity: nil]; + sqlFormat = [(PostgreSQLAdaptor*)[[self adaptorContext]adaptor] primaryKeySequenceNameFormat]; sqlString = [NSString stringWithFormat: sqlFormat, [entity primaryKeyRootName]]; - + sqlString = [sqlExpr sqlStringForSchemaObjectName: sqlString]; + sqlString=[NSString stringWithFormat: @"SELECT nextval('%@')", + sqlString]; + if ([self isDebugEnabled]) { NSLog(@"PostgreSQLAdaptor: '%@'", sqlString);