Re: Query ID Values

2018-05-14 Thread David G. Johnston
I'd bottom-post, as is the convention for these lists, but it seems pointless now... CASE *expression* WHEN *value* THEN *result* [WHEN ...] [ELSE *result*] END Try that where expression is the %s. The values and results are simple literals. And you compare the result of the express

Re: Query ID Values

2018-05-14 Thread tango ward
Fixed the case statement SELECT id FROM education_program WHERE name = CASE %s WHEN 'SENIOR HIGH SCHOOL GAS' THEN 'General Academic Strand' WHEN 'SENIOR HIGH SCHO

Re: Query ID Values

2018-05-14 Thread tango ward
I thing its this: " Note cursor objects are iterable, so, instead of calling explicitly fetchone() in a loop, the object itself can be used: >>> cur.execute("SELECT * FROM test;")>>> f

Re: Query ID Values

2018-05-14 Thread Ian Zimmerman
On 2018-05-14 21:12, Adrian Klaver wrote: > Because you are doing fetchall(). That is going to fetch a list of row > tuples. Either iterate over that list or iterate over the cursor: > > for row in cur_p: > print(row) > > For more info see: > http://initd.org/psycopg/docs/cursor.html Whe

Re: Query ID Values

2018-05-14 Thread tango ward
Noted Sir Adrian. The course name for the ones that are blank are not match with the ones in the profile_program table. I am writing a CASE Statement right now to verify the data but I can't make it work.: for row in cur_t: course = row['course'] cur_p.execute("""

Re: Query ID Values

2018-05-14 Thread Adrian Klaver
On 05/14/2018 08:30 PM, tango ward wrote: for row in cur_t:     course = row['course']     cur_p.execute("""   SELECT id   FROM education_program   WHERE name=%s   AND department_id

Re: RPM packages 10.4 for rhel7 x86_86 are build as f25.x86_64.rpm

2018-05-14 Thread cwlists
Hi, I see that the f25 packages for 10.4 are now rebuilt with rhel7 ones. Thanks. On Mon, May 14, 2018 at 6:22 AM cwlists wrote: > Hi, > > Maybe this is not an issue, but first time I see it. > > Only for 10.4 and rhel7 x86_64 I can see this issue (*). They are > consistent for earlier releases

Re: Query ID Values

2018-05-14 Thread tango ward
for row in cur_t: course = row['course'] cur_p.execute(""" SELECT id FROM education_program WHERE name=%s AND department_id IN (SELECT id FROM profile_de

Re: Query ID Values

2018-05-14 Thread tango ward
Hi, Yes sorry, here's the tables: [cur_t DB] [student_profile table] Column| Type | Collation | Nullable |Default| --++---+--+---+ studentnumber| character

Re: 10.4 upgrade, function markings, and template0

2018-05-14 Thread Michael Paquier
On Mon, May 14, 2018 at 05:22:39PM -0400, Tom Lane wrote: > Maybe it'd be worth building some sort of infrastructure that would > allow this to be done at a lower level. It's not hard to imagine > an autovacuum-like or bgworker-based thingy that could run around > and apply a given SQL script in e

Re: Query ID Values

2018-05-14 Thread David G. Johnston
On Monday, May 14, 2018, tango ward wrote: > > May I ask an advice on how to approach this? > I can't make heads nor tails of your description...but there isn't IF in SQL. But you may get some mileage out of simple joins. David J.

Query ID Values

2018-05-14 Thread tango ward
Good Day, I need to run an SQL query and get a program_id and department_id of a specific course for each student. I am thinking of running an IF condition to check if the course name is in program and get it's ID but I don't know yet where to use the IF condition in the query. sample code: for

Re: Strange error in Windows 10 Pro

2018-05-14 Thread Dale Seaburg
Just to put a finishing note to this thread: I am placing the blame on the mfg of the PC - was supposed to be a NEW, but had a Reburbished sticker on the bottom of the case.  Now, whether it was the PC mfg or Microsoft's fault, I really could care less - the PC became useless for installing Po

Re: 10.4 upgrade, function markings, and template0

2018-05-14 Thread Dominic Jones
On Mon, 14 May 2018 17:02:25 -0400 Tom Lane wrote: > Dominic Jones writes: > > The PostgreSQL 10.4 upgrade involves changes to some function markings (see > > release notes, E.1.2, second and third bullet points for specifics). One > > way to make these changes is to use `ALTER FUNCTION` to ch

Re: 10.4 upgrade, function markings, and template0

2018-05-14 Thread Adrian Klaver
On 05/14/2018 02:22 PM, Tom Lane wrote: Adrian Klaver writes: On 05/14/2018 02:02 PM, Tom Lane wrote: I didn't bother with spelling it all out in full detail this time, which maybe was a mistake, but I felt that probably most users wouldn't need to bother with these changes at all (unlike the

Re: 10.4 upgrade, function markings, and template0

2018-05-14 Thread Tom Lane
Adrian Klaver writes: > On 05/14/2018 02:02 PM, Tom Lane wrote: >> I didn't bother with spelling it all out in full detail this time, >> which maybe was a mistake, but I felt that probably most users >> wouldn't need to bother with these changes at all (unlike the case >> where a catalog correctio

Re: 10.4 upgrade, function markings, and template0

2018-05-14 Thread Adrian Klaver
On 05/14/2018 02:02 PM, Tom Lane wrote: Dominic Jones writes: The PostgreSQL 10.4 upgrade involves changes to some function markings (see release notes, E.1.2, second and third bullet points for specifics). One way to make these changes is to use `ALTER FUNCTION` to change the functions in yo

Re: 10.4 upgrade, function markings, and template0

2018-05-14 Thread Tom Lane
Dominic Jones writes: > The PostgreSQL 10.4 upgrade involves changes to some function markings (see > release notes, E.1.2, second and third bullet points for specifics). One way > to make these changes is to use `ALTER FUNCTION` to change the functions in > your existing databases. While this

Re: 10.4 upgrade, function markings, and template0

2018-05-14 Thread David G. Johnston
On Mon, May 14, 2018 at 1:42 PM, Dominic Jones wrote: > Good afternoon, > > The PostgreSQL 10.4 upgrade involves changes to some function markings > (see release notes, E.1.2, second and third bullet points for specifics). > One way to make these changes is to use `ALTER FUNCTION` to change the >

10.4 upgrade, function markings, and template0

2018-05-14 Thread Dominic Jones
Good afternoon, The PostgreSQL 10.4 upgrade involves changes to some function markings (see release notes, E.1.2, second and third bullet points for specifics). One way to make these changes is to use `ALTER FUNCTION` to change the functions in your existing databases. While this was mainly str

Re: Rapid disk usage spikes when updating large tables with GIN indexes

2018-05-14 Thread Jonathan Marks
We’ll turn on log_temp_files and get back to you to see if that’s the cause. Re: the exact queries — these are just normal INSERTs and UPDATEs. This occurs as part of normal database operations — i.e., we are processing 10% of a table and marking changes to a particular row, or happen to be inse

Re: Rapid disk usage spikes when updating large tables with GIN indexes

2018-05-14 Thread Tom Lane
[ please keep the list cc'd ] Jonathan Marks writes: > Thanks for your quick reply. Here’s a bit more information: > 1) to measure the “size of the database” we run something like `select > datname, pg_size_pretty(pg_database_size(datname)) from pg_database;` I’m not > sure if this includes WAL

Re: Rapid disk usage spikes when updating large tables with GIN indexes

2018-05-14 Thread Tom Lane
Jonathan Marks writes: > One recurring, and predictable, issue that we have experienced regularly for > multiple years is that inserting or updating rows in any table with GIN > indexes results in extremely large drops in free disk space — i.e. inserting > 10k rows with a total size of 10GB can

Re: Recommended way to copy database files on Windows OS (to perform file system level backup)

2018-05-14 Thread Andreas Kretschmer
>An easy way to perform backup of your data is to use PostgreSQL's very >own >pg_dump utility. That's not a file level backup, but a logical backup. Maybe he wants to build standby for streaming replication, for this you needs an other backup. See the answer from Christoph. Andreas -- 2ndQua

Rapid disk usage spikes when updating large tables with GIN indexes

2018-05-14 Thread Jonathan Marks
Hello! We have a mid-sized database on RDS running 10.1 (32 cores, 240 GB RAM, 5TB total disk space, 20k PIOPS) with several large (100GB+, tens of millions of rows) tables that use GIN indexes for full-text search. We at times need to index very large (hundreds of pages) documents and as a res

Re: Recommended way to copy database files on Windows OS (to perform file system level backup)

2018-05-14 Thread Christoph Moench-Tegeder
## Yashwanth Govinda Setty (ygovindase...@commvault.com): > We are facing this problem while performing file system level backup of > database files: > As each database will form a directory inside Base directory which consists > of files representing the tables, when some tables are dropped dur

Re: Recommended way to copy database files on Windows OS (to perform file system level backup)

2018-05-14 Thread Allan Kamau
On Mon, May 14, 2018 at 2:22 PM, Yashwanth Govinda Setty < ygovindase...@commvault.com> wrote: > Hi all, > > > > We are facing this problem while performing file system level backup of > database files: > > As each database will form a directory inside Base directory which > consists of files repr

Re: Recommended way to copy database files on Windows OS (to perform file system level backup)

2018-05-14 Thread James Keener
A bit of pedanticism: > So we would like to know how you recommend copying PostgreSQL database files in Windows OS to perform file system level backups. (For Example – The recommended way in Linux is to use tar format.) That is not what a file-system-level back up is, and not what tar does at a

Recommended way to copy database files on Windows OS (to perform file system level backup)

2018-05-14 Thread Yashwanth Govinda Setty
Hi all, We are facing this problem while performing file system level backup of database files: As each database will form a directory inside Base directory which consists of files representing the tables, when some tables are dropped during backup, We get error while copying since the files do

Re: How can I retrieve attribute category with attribute Oid in Cfunction?

2018-05-14 Thread Laurenz Albe
a wrote: > could you provide some more detail information?? > > What function should I use to get FormData_pg_type structure?? > > BTW, I searched another function called "lookup_type_cache", which will > return a pointer of structure of "TypeCacheEntry". > > The structure contains "TypeCacheE

Re: How can I retrieve attribute category with attribute Oid in Cfunction?

2018-05-14 Thread a
BTW, I searched another function called "lookup_type_cache", which will return a pointer of structure of "TypeCacheEntry". The structure contains "TypeCacheEntry.typtype" that may also help to identify the type. But I'm concerning about possible memory leak and allocation stuff. Is it safe t

Re: How can I retrieve attribute category with attribute Oid in Cfunction?

2018-05-14 Thread a
hey thank you!! could you provide some more detail information?? What function should I use to get FormData_pg_type structure?? thanks a lot -- Original message -- From: "Laurenz Albe"; Sendtime: Monday, May 14, 2018 4:11 PM To: "a"<372660...@qq.com>; "pgs

Re: How can I retrieve attribute category with attribute Oid in C function?

2018-05-14 Thread Laurenz Albe
a wrote: > Hi I am writing something that would need to identify the attribute category > inside a C function, > now I may need a way of fast access it, but the information is not stored in > FormData_pg_attribute structure. Are you talking about pg_type.typcategory? That is accessible from For

How can I retrieve attribute category with attribute Oid in C function?

2018-05-14 Thread a
Hi I am writing something that would need to identify the attribute category inside a C function, now I may need a way of fast access it, but the information is not stored in FormData_pg_attribute structure. Can anyone help? Thanks a lot!!! Shore