Thread: PostgreSQL source code: copy command

PostgreSQL source code: copy command

From
Adam Dziedzic
Date:
Hello,

in file: /src/backend/command/copy.c
I found that it can happen that there is nothing in the buffer (fe_msgbuf) to be written to a file and there is only a check of count (which in this case would be 0):

498  if (fwrite(fe_msgbuf->data, fe_msgbuf->len, 1,
499  cstate->copy_file) != 1 ||
500  ferror(cstate->copy_file))
501

Maybe, before the fwrite we should check if fe_msgbuf->len > 0.


--
With kind regards,
Adam Dziedzic
Attachment

Re: PostgreSQL source code: copy command

From
Tom Lane
Date:
Adam Dziedzic <adam.dziedzi@gmail.com> writes:
> in file: /src/backend/command/copy.c
> I found that it can happen that there is nothing in the buffer
> (fe_msgbuf) to be written to a file and there is only a check of count
> (which in this case would be 0):

> 498  if (fwrite(fe_msgbuf->data, fe_msgbuf->len, 1,
> 499  cstate->copy_file) != 1 ||
> 500  ferror(cstate->copy_file))

On what grounds do you claim that control can reach there without any
data in the buffer?  AFAICS, there must be at least either a row header
(if binary mode) or trailer (if not).

            regards, tom lane


Last Chance to Defend Your Freedom

From
"Robert Beyne"
Date:


Dear Fellow U.S. Citizen,

As described in the letter below, this December, President Obama is planning to make the U.S. a state of a global government and is taking executive action to redistribute what we earn and own to all developing countries worldwide.

To keep this from happening, take action as soon as possible!

·         Please, read the letter below to understand what Obama and the U.N. are plotting to do against us and what your Senators and Representatives can do to stop him.

·         Forward this email unchanged to everyone you know or otherwise can contact.

·         On http://www.house.gov/, enter you zip code and press Go, or on http://www.house.gov/representatives/, click the first letter of your state, then click on the link (their name) to your Representative’s website. Navigate to your Representative’s contact page. Copy and paste the letter below into your Representative’s contact page, and send it to your Representative.

·         On http://www.senate.gov/senators/contact/, choose your state, and click the link to your Senator’s website’s contact page or website. Copy and paste the letter below into your Senator’s contact page, and send it to your Senator.

Your future depends on you. Make taking those steps a high priority. Thank you.

Here is the text of the letter …

 

SUBJECT: Last Chance to Defend Our Freedom – Impeach and Imprison Obama

Being a U.S. citizen, it is my civic duty and honor to write to you regarding a matter of grave national consequences.

This December, at the 21st meeting of the U.N. Framework Convention on Climate Change (UN FCCC) Conference of the Parties (COP-21) in Paris, France, President Obama intends to enter the U.S., that is to enter We the People, into a legally-binding agreement. This agreement will make the U.S. a state of a global government; the UN FCCC COP. This global government will make decisions that subvert our national sovereignty and the Constitution of the United States. It will assume control of the global economy; socializing it by monetizing greenhouse gas emission allowances and allocating those allowances to countries worldwide. To developing countries, it will allocate surplus allowances, but to the U.S. it will allocate less than we need to continue our present fossil fuel usage. President Obama and the COP will require We the People to purchase periodically increasing numbers of allowances from developing countries; redistributing increasing amounts of our hard earned money to foreigners through the cap-and-trade scheme that President Obama is imposing on us through executive actions. This will cause the price of every U.S. made product to increase, reduce our purchasing power, and drive us into entitlement programs such as Obama’s Making Work Pay. Furthermore, the COP will require the U.S. to revoke intellectual property rights of U.S. industries, businesses, and citizens, to redistribute our trade secrets and patents to developing countries where it will be used to create industry and businesses that will take away our jobs and dignity; also forcing us into financial hardship, heartache, and entitlement programs. When natural disasters occur in developing countries, instead of the citizens of those countries staying and rebuilding, the COP will require the U.S. to take them in as environmental refugees; giving them our land for compensation for their loss, and increasing the number of people competing for our jobs and being given our tax dollars through entitlement programs. Also, if all these actions and others cause the U.S. economy to crash, developing countries and the COP will continue to take what is ours with heartless disregard for our welfare. Obama’s and the UN FCCC’s plans against us are criminal, malevolent, and unconscionable.

When President Obama enters We the People into that legally-binding agreement with the UN FCCC, you shall take action. First, Senators, for the sake of our nation and to defend our future, reject that legally-binding agreement with the UN FCCC. Second, for waging political and economic warfare against We the People, that is for signing that agreement which will oppress us under a global government and for imposing a cap-and-trade scheme on us which will redistribute our money to the developing world, charge President Obama with treason according to Article III. Section 3. of the Constitution and with high crimes according to Article III. Section 4. of the Constitution. Representatives, impeach President Obama according to Article I. Section 2. of the Constitution and Senators, try his impeachment and impeach him according to Article I. Section 3. of the Constitution. Third, charge former President Obama with one count of capital theft for each U.S. citizen whose hard-earned income has already been stolen to fund green energy, cooperative R&D, and other projects in foreign countries and will be stolen under the UN FCCC and through Obama’s and the UN FCCC’s cap-and-trade scheme; so that he may be indicted, tried, judged, and incarcerated for multiple lifetime sentences without any opportunity for parole.

You have a decision to make regarding your service to your state constituency. Will you violate your oath to defend the Constitution of the United States from all enemies foreign and domestic, ratifying its subversion and that of our sovereignty, or will you reject further actions subverting it; defending our Constitution and our right to freedom and self-governance? Will you impose untold hardship and despair on We the People, or will you bring relief and restore hope? Will you be an accomplice to the plundering of our money, trade secrets, patents, industry, businesses, jobs, and land, or will you protect us from fraud and theft; rejecting any legally-binding agreement with the UN FCCC, impeaching President Obama, and charging him for his crimes against We the People?